Also install their headers to a subdirectory.
# GTK+ header files for public installation (non-generated, or generated
# by configure)
+
+deprecated_h_sources = \
+ deprecated/gtkfontsel.h \
+ deprecated/gtkhandlebox.h \
+ deprecated/gtkhbbox.h \
+ deprecated/gtkhbox.h \
+ deprecated/gtkhpaned.h \
+ deprecated/gtkhscale.h \
+ deprecated/gtkhscrollbar.h \
+ deprecated/gtkhseparator.h \
+ deprecated/gtktable.h \
+ deprecated/gtktearoffmenuitem.h \
+ deprecated/gtkvbbox.h \
+ deprecated/gtkvbox.h \
+ deprecated/gtkvscale.h \
+ deprecated/gtkvscrollbar.h \
+ deprecated/gtkvseparator.h \
+ deprecated/gtkvpaned.h
+
gtk_public_h_sources = \
gtk.h \
gtkx.h \
gtkfilefilter.h \
gtkfixed.h \
gtkfontbutton.h \
- gtkfontsel.h \
- gtkfontchooser.h \
+ gtkfontchooser.h \
gtkfontchooserdialog.h \
gtkfontchooserwidget.h \
gtkframe.h \
gtkgradient.h \
gtkgrid.h \
- gtkhandlebox.h \
- gtkhbbox.h \
- gtkhbox.h \
- gtkhpaned.h \
- gtkhscale.h \
- gtkhscrollbar.h \
- gtkhseparator.h \
gtkhsv.h \
gtkiconfactory.h \
gtkicontheme.h \
gtkstyle.h \
gtkswitch.h \
gtksymboliccolor.h \
- gtktable.h \
- gtktearoffmenuitem.h \
gtktestutils.h \
gtktextattributes.h \
gtktextbuffer.h \
gtktreeview.h \
gtktreeviewcolumn.h \
gtkuimanager.h \
- gtkvbbox.h \
- gtkvbox.h \
gtkviewport.h \
gtkvolumebutton.h \
- gtkvpaned.h \
- gtkvscale.h \
- gtkvscrollbar.h \
- gtkvseparator.h \
gtkwidget.h \
gtkwidgetpath.h \
gtkwindow.h
$(gtk_appchooser_impl_h_sources)
# GTK+ C sources to build the library from
+deprecated_c_sources = \
+ deprecated/gtkfontsel.c \
+ deprecated/gtkhandlebox.c \
+ deprecated/gtkhbbox.c \
+ deprecated/gtkhbox.c \
+ deprecated/gtkhpaned.c \
+ deprecated/gtkhscale.c \
+ deprecated/gtkhscrollbar.c \
+ deprecated/gtkhseparator.c \
+ deprecated/gtktable.c \
+ deprecated/gtktearoffmenuitem.c \
+ deprecated/gtkvbbox.c \
+ deprecated/gtkvbox.c \
+ deprecated/gtkvscale.c \
+ deprecated/gtkvscrollbar.c \
+ deprecated/gtkvseparator.c \
+ deprecated/gtkvpaned.c
+
gtk_base_c_sources = \
+ $(deprecated_c_sources) \
gtkquery.c \
gtksearchengine.c \
gtksearchenginesimple.c \
gtkbin.c \
gtkbindings.c \
gtkborder.c \
- gtkborderimage.c \
+ gtkborderimage.c \
gtkbox.c \
gtkbuildable.c \
gtkbuilder.c \
gtkfilesystemmodel.c \
gtkfixed.c \
gtkfontbutton.c \
- gtkfontsel.c \
- gtkfontchooser.c \
- gtkfontchooserdialog.c \
+ gtkfontchooser.c \
+ gtkfontchooserdialog.c \
gtkfontchooserutils.c \
gtkfontchooserwidget.c \
gtkframe.c \
gtkgradient.c \
gtkgrid.c \
- gtkhandlebox.c \
- gtkhbbox.c \
- gtkhbox.c \
- gtkhpaned.c \
- gtkhscale.c \
- gtkhscrollbar.c \
- gtkhseparator.c \
gtkhsv.c \
gtkiconcache.c \
gtkiconcachevalidator.c \
gtkstyle.c \
gtkswitch.c \
gtksymboliccolor.c \
- gtktable.c \
- gtktearoffmenuitem.c \
gtktestutils.c \
gtktextattributes.c \
gtktextbtree.c \
gtktreeviewcolumn.c \
gtktypebuiltins.c \
gtkuimanager.c \
- gtkvbbox.c \
- gtkvbox.c \
gtkvolumebutton.c \
gtkviewport.c \
- gtkvpaned.c \
- gtkvscale.c \
- gtkvscrollbar.c \
- gtkvseparator.c \
gtkwidget.c \
gtkwidgetpath.c \
gtkwindow.c \
gtkincludedir = $(includedir)/gtk-3.0/gtk
gtkinclude_HEADERS = $(gtk_public_h_sources) $(gtk_semi_private_h_sources) $(gtk_built_public_sources) gtkversion.h
+deprecatedincludedir = $(includedir)/gtk-3.0/gtk/deprecated
+deprecatedinclude_HEADERS= $(deprecated_h_sources)
+
gtkunixprintincludedir = $(includedir)/gtk-3.0/unix-print/gtk
gtkunixprintinclude_HEADERS = $(gtk_unix_print_public_h_sources)
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * Massively updated for Pango by Owen Taylor, May 2000
+ * GtkFontSelection widget for Gtk+, by Damon Chaplin, May 1998.
+ * Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
+ * The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <glib/gprintf.h>
+#include <string.h>
+
+#include <atk/atk.h>
+
+#include "gtkbutton.h"
+#include "gtkcellrenderertext.h"
+#include "gtkentry.h"
+#include "gtkframe.h"
+#include "gtklabel.h"
+#include "gtkliststore.h"
+#include "gtkstock.h"
+#include "gtktable.h"
+#include "gtktreeselection.h"
+#include "gtktreeview.h"
+#include "gtkscrolledwindow.h"
+#include "gtkintl.h"
+#include "gtkaccessible.h"
+#include "gtkbuildable.h"
+#include "gtkorientable.h"
+#include "gtkprivate.h"
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
+#include "gtkfontsel.h"
+
+/**
+ * SECTION:gtkfontsel
+ * @Short_description: Deprecated widget for selecting fonts
+ * @Title: GtkFontSelection
+ * @See_also: #GtkFontSelectionDialog, #GtkFontChooser
+ *
+ * The #GtkFontSelection widget lists the available fonts, styles and sizes,
+ * allowing the user to select a font.
+ * It is used in the #GtkFontSelectionDialog widget to provide a dialog box for
+ * selecting fonts.
+ *
+ * To set the font which is initially selected, use
+ * gtk_font_selection_set_font_name().
+ *
+ * To get the selected font use gtk_font_selection_get_font_name().
+ *
+ * To change the text which is shown in the preview area, use
+ * gtk_font_selection_set_preview_text().
+ *
+ * In GTK+ 3.2, #GtkFontSelection has been deprecated in favor of
+ * #GtkFontChooser.
+ */
+
+
+struct _GtkFontSelectionPrivate
+{
+ GtkWidget *font_entry; /* Used _get_family_entry() for consistency, -mr */
+ GtkWidget *font_style_entry; /* Used _get_face_entry() for consistency, -mr */
+
+ GtkWidget *size_entry;
+ GtkWidget *preview_entry;
+
+ GtkWidget *family_list;
+ GtkWidget *face_list;
+ GtkWidget *size_list;
+
+ PangoFontFamily *family; /* Current family */
+ PangoFontFace *face; /* Current face */
+
+ gint size;
+};
+
+
+struct _GtkFontSelectionDialogPrivate
+{
+ GtkWidget *fontsel;
+
+ GtkWidget *ok_button;
+ GtkWidget *apply_button;
+ GtkWidget *cancel_button;
+};
+
+
+/* We don't enable the font and style entries because they don't add
+ * much in terms of visible effect and have a weird effect on keynav.
+ * the Windows font selector has entries similarly positioned but they
+ * act in conjunction with the associated lists to form a single focus
+ * location.
+ */
+#undef INCLUDE_FONT_ENTRIES
+
+/* This is the default text shown in the preview entry, though the user
+ can set it. Remember that some fonts only have capital letters. */
+#define PREVIEW_TEXT N_("abcdefghijk ABCDEFGHIJK")
+
+#define DEFAULT_FONT_NAME "Sans 10"
+
+/* This is the initial and maximum height of the preview entry (it expands
+ when large font sizes are selected). Initial height is also the minimum. */
+#define INITIAL_PREVIEW_HEIGHT 44
+#define MAX_PREVIEW_HEIGHT 300
+
+/* These are the sizes of the font, style & size lists. */
+#define FONT_LIST_HEIGHT 136
+#define FONT_LIST_WIDTH 190
+#define FONT_STYLE_LIST_WIDTH 170
+#define FONT_SIZE_LIST_WIDTH 60
+
+/* These are what we use as the standard font sizes, for the size list.
+ */
+static const guint16 font_sizes[] = {
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28,
+ 32, 36, 40, 48, 56, 64, 72
+};
+
+enum {
+ PROP_0,
+ PROP_FONT_NAME,
+ PROP_PREVIEW_TEXT
+};
+
+
+enum {
+ FAMILY_COLUMN,
+ FAMILY_NAME_COLUMN
+};
+
+enum {
+ FACE_COLUMN,
+ FACE_NAME_COLUMN
+};
+
+enum {
+ SIZE_COLUMN
+};
+
+static void gtk_font_selection_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_font_selection_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gtk_font_selection_finalize (GObject *object);
+static void gtk_font_selection_screen_changed (GtkWidget *widget,
+ GdkScreen *previous_screen);
+static void gtk_font_selection_style_updated (GtkWidget *widget);
+
+/* These are the callbacks & related functions. */
+static void gtk_font_selection_select_font (GtkTreeSelection *selection,
+ gpointer data);
+static void gtk_font_selection_show_available_fonts (GtkFontSelection *fs);
+
+static void gtk_font_selection_show_available_styles (GtkFontSelection *fs);
+static void gtk_font_selection_select_best_style (GtkFontSelection *fs,
+ gboolean use_first);
+static void gtk_font_selection_select_style (GtkTreeSelection *selection,
+ gpointer data);
+
+static void gtk_font_selection_select_best_size (GtkFontSelection *fs);
+static void gtk_font_selection_show_available_sizes (GtkFontSelection *fs,
+ gboolean first_time);
+static void gtk_font_selection_size_activate (GtkWidget *w,
+ gpointer data);
+static gboolean gtk_font_selection_size_focus_out (GtkWidget *w,
+ GdkEventFocus *event,
+ gpointer data);
+static void gtk_font_selection_select_size (GtkTreeSelection *selection,
+ gpointer data);
+
+static void gtk_font_selection_scroll_on_map (GtkWidget *w,
+ gpointer data);
+
+static void gtk_font_selection_preview_changed (GtkWidget *entry,
+ GtkFontSelection *fontsel);
+static void gtk_font_selection_scroll_to_selection (GtkFontSelection *fontsel);
+
+
+/* Misc. utility functions. */
+static void gtk_font_selection_load_font (GtkFontSelection *fs);
+static void gtk_font_selection_update_preview (GtkFontSelection *fs);
+
+static PangoFontDescription *gtk_font_selection_get_font_description (GtkFontSelection *fontsel);
+static gboolean gtk_font_selection_select_font_desc (GtkFontSelection *fontsel,
+ PangoFontDescription *new_desc,
+ PangoFontFamily **pfamily,
+ PangoFontFace **pface);
+static void gtk_font_selection_reload_fonts (GtkFontSelection *fontsel);
+static void gtk_font_selection_ref_family (GtkFontSelection *fontsel,
+ PangoFontFamily *family);
+static void gtk_font_selection_ref_face (GtkFontSelection *fontsel,
+ PangoFontFace *face);
+
+G_DEFINE_TYPE (GtkFontSelection, gtk_font_selection, GTK_TYPE_BOX)
+
+static void
+gtk_font_selection_class_init (GtkFontSelectionClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gobject_class->finalize = gtk_font_selection_finalize;
+ gobject_class->set_property = gtk_font_selection_set_property;
+ gobject_class->get_property = gtk_font_selection_get_property;
+
+ widget_class->screen_changed = gtk_font_selection_screen_changed;
+ widget_class->style_updated = gtk_font_selection_style_updated;
+
+ g_object_class_install_property (gobject_class,
+ PROP_FONT_NAME,
+ g_param_spec_string ("font-name",
+ P_("Font name"),
+ P_("The string that represents this font"),
+ DEFAULT_FONT_NAME,
+ GTK_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_PREVIEW_TEXT,
+ g_param_spec_string ("preview-text",
+ P_("Preview text"),
+ P_("The text to display in order to demonstrate the selected font"),
+ _(PREVIEW_TEXT),
+ GTK_PARAM_READWRITE));
+
+ g_type_class_add_private (klass, sizeof (GtkFontSelectionPrivate));
+}
+
+static void
+gtk_font_selection_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkFontSelection *fontsel;
+
+ fontsel = GTK_FONT_SELECTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_FONT_NAME:
+ gtk_font_selection_set_font_name (fontsel, g_value_get_string (value));
+ break;
+ case PROP_PREVIEW_TEXT:
+ gtk_font_selection_set_preview_text (fontsel, g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void gtk_font_selection_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkFontSelection *fontsel;
+
+ fontsel = GTK_FONT_SELECTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_FONT_NAME:
+ g_value_take_string (value, gtk_font_selection_get_font_name (fontsel));
+ break;
+ case PROP_PREVIEW_TEXT:
+ g_value_set_string (value, gtk_font_selection_get_preview_text (fontsel));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/* Handles key press events on the lists, so that we can trap Enter to
+ * activate the default button on our own.
+ */
+static gboolean
+list_row_activated (GtkWidget *widget)
+{
+ GtkWidget *default_widget, *focus_widget;
+ GtkWindow *window;
+
+ window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
+ if (!gtk_widget_is_toplevel (GTK_WIDGET (window)))
+ window = NULL;
+
+ if (window)
+ {
+ default_widget = gtk_window_get_default_widget (window);
+ focus_widget = gtk_window_get_focus (window);
+
+ if (widget != default_widget &&
+ !(widget == focus_widget && (!default_widget || !gtk_widget_get_sensitive (default_widget))))
+ gtk_window_activate_default (window);
+ }
+
+ return TRUE;
+}
+
+static void
+gtk_font_selection_init (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv;
+ GtkWidget *scrolled_win;
+ GtkWidget *text_box;
+ GtkWidget *table, *label;
+ GtkWidget *font_label, *style_label;
+ GtkWidget *vbox;
+ GtkListStore *model;
+ GtkTreeViewColumn *column;
+ GList *focus_chain = NULL;
+ AtkObject *atk_obj;
+
+ fontsel->priv = G_TYPE_INSTANCE_GET_PRIVATE (fontsel,
+ GTK_TYPE_FONT_SELECTION,
+ GtkFontSelectionPrivate);
+ priv = fontsel->priv;
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (fontsel),
+ GTK_ORIENTATION_VERTICAL);
+
+ gtk_widget_push_composite_child ();
+
+ gtk_box_set_spacing (GTK_BOX (fontsel), 12);
+ priv->size = 12 * PANGO_SCALE;
+
+ /* Create the table of font, style & size. */
+ table = gtk_table_new (3, 3, FALSE);
+ gtk_widget_show (table);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_box_pack_start (GTK_BOX (fontsel), table, TRUE, TRUE, 0);
+
+#ifdef INCLUDE_FONT_ENTRIES
+ priv->font_entry = gtk_entry_new ();
+ gtk_editable_set_editable (GTK_EDITABLE (priv->font_entry), FALSE);
+ gtk_widget_set_size_request (priv->font_entry, 20, -1);
+ gtk_widget_show (priv->font_entry);
+ gtk_table_attach (GTK_TABLE (table), priv->font_entry, 0, 1, 1, 2,
+ GTK_FILL, 0, 0, 0);
+
+ priv->font_style_entry = gtk_entry_new ();
+ gtk_editable_set_editable (GTK_EDITABLE (priv->font_style_entry), FALSE);
+ gtk_widget_set_size_request (priv->font_style_entry, 20, -1);
+ gtk_widget_show (priv->font_style_entry);
+ gtk_table_attach (GTK_TABLE (table), priv->font_style_entry, 1, 2, 1, 2,
+ GTK_FILL, 0, 0, 0);
+#endif /* INCLUDE_FONT_ENTRIES */
+
+ priv->size_entry = gtk_entry_new ();
+ gtk_widget_set_size_request (priv->size_entry, 20, -1);
+ gtk_widget_show (priv->size_entry);
+ gtk_table_attach (GTK_TABLE (table), priv->size_entry, 2, 3, 1, 2,
+ GTK_FILL, 0, 0, 0);
+ g_signal_connect (priv->size_entry, "activate",
+ G_CALLBACK (gtk_font_selection_size_activate),
+ fontsel);
+ g_signal_connect_after (priv->size_entry, "focus-out-event",
+ G_CALLBACK (gtk_font_selection_size_focus_out),
+ fontsel);
+
+ font_label = gtk_label_new_with_mnemonic (_("_Family:"));
+ gtk_widget_set_halign (font_label, GTK_ALIGN_START);
+ gtk_widget_set_valign (font_label, GTK_ALIGN_CENTER);
+ gtk_widget_show (font_label);
+ gtk_table_attach (GTK_TABLE (table), font_label, 0, 1, 0, 1,
+ GTK_FILL, 0, 0, 0);
+
+ style_label = gtk_label_new_with_mnemonic (_("_Style:"));
+ gtk_widget_set_halign (style_label, GTK_ALIGN_START);
+ gtk_widget_set_valign (style_label, GTK_ALIGN_CENTER);
+ gtk_widget_show (style_label);
+ gtk_table_attach (GTK_TABLE (table), style_label, 1, 2, 0, 1,
+ GTK_FILL, 0, 0, 0);
+
+ label = gtk_label_new_with_mnemonic (_("Si_ze:"));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label),
+ priv->size_entry);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
+ GTK_FILL, 0, 0, 0);
+
+
+ /* Create the lists */
+
+ model = gtk_list_store_new (2,
+ G_TYPE_OBJECT, /* FAMILY_COLUMN */
+ G_TYPE_STRING); /* FAMILY_NAME_COLUMN */
+ priv->family_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+ g_object_unref (model);
+
+ g_signal_connect (priv->family_list, "row-activated",
+ G_CALLBACK (list_row_activated), fontsel);
+
+ column = gtk_tree_view_column_new_with_attributes ("Family",
+ gtk_cell_renderer_text_new (),
+ "text", FAMILY_NAME_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (priv->family_list), column);
+
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->family_list), FALSE);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list)),
+ GTK_SELECTION_BROWSE);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (font_label), priv->family_list);
+
+ scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
+ gtk_widget_set_size_request (scrolled_win,
+ FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
+ gtk_container_add (GTK_CONTAINER (scrolled_win), priv->family_list);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ gtk_widget_show (priv->family_list);
+ gtk_widget_show (scrolled_win);
+
+ gtk_table_attach (GTK_TABLE (table), scrolled_win, 0, 1, 1, 3,
+ GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL, 0, 0);
+ focus_chain = g_list_append (focus_chain, scrolled_win);
+
+ model = gtk_list_store_new (2,
+ G_TYPE_OBJECT, /* FACE_COLUMN */
+ G_TYPE_STRING); /* FACE_NAME_COLUMN */
+ priv->face_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+ g_object_unref (model);
+ g_signal_connect (priv->face_list, "row-activated",
+ G_CALLBACK (list_row_activated), fontsel);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (style_label), priv->face_list);
+
+ column = gtk_tree_view_column_new_with_attributes ("Face",
+ gtk_cell_renderer_text_new (),
+ "text", FACE_NAME_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (priv->face_list), column);
+
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->face_list), FALSE);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list)),
+ GTK_SELECTION_BROWSE);
+
+ scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
+ gtk_widget_set_size_request (scrolled_win,
+ FONT_STYLE_LIST_WIDTH, FONT_LIST_HEIGHT);
+ gtk_container_add (GTK_CONTAINER (scrolled_win), priv->face_list);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ gtk_widget_show (priv->face_list);
+ gtk_widget_show (scrolled_win);
+ gtk_table_attach (GTK_TABLE (table), scrolled_win, 1, 2, 1, 3,
+ GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL, 0, 0);
+ focus_chain = g_list_append (focus_chain, scrolled_win);
+
+ focus_chain = g_list_append (focus_chain, priv->size_entry);
+
+ model = gtk_list_store_new (1, G_TYPE_INT);
+ priv->size_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+ g_object_unref (model);
+ g_signal_connect (priv->size_list, "row-activated",
+ G_CALLBACK (list_row_activated), fontsel);
+
+ column = gtk_tree_view_column_new_with_attributes ("Size",
+ gtk_cell_renderer_text_new (),
+ "text", SIZE_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (priv->size_list), column);
+
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->size_list), FALSE);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list)),
+ GTK_SELECTION_BROWSE);
+
+ scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (scrolled_win), priv->size_list);
+ gtk_widget_set_size_request (scrolled_win, -1, FONT_LIST_HEIGHT);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+ GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+ gtk_widget_show (priv->size_list);
+ gtk_widget_show (scrolled_win);
+ gtk_table_attach (GTK_TABLE (table), scrolled_win, 2, 3, 2, 3,
+ GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ focus_chain = g_list_append (focus_chain, scrolled_win);
+
+ gtk_container_set_focus_chain (GTK_CONTAINER (table), focus_chain);
+ g_list_free (focus_chain);
+
+ /* Insert the fonts. */
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list)), "changed",
+ G_CALLBACK (gtk_font_selection_select_font), fontsel);
+
+ g_signal_connect_after (priv->family_list, "map",
+ G_CALLBACK (gtk_font_selection_scroll_on_map),
+ fontsel);
+
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list)), "changed",
+ G_CALLBACK (gtk_font_selection_select_style), fontsel);
+
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list)), "changed",
+ G_CALLBACK (gtk_font_selection_select_size), fontsel);
+ atk_obj = gtk_widget_get_accessible (priv->size_list);
+ if (GTK_IS_ACCESSIBLE (atk_obj))
+ {
+ /* Accessibility support is enabled.
+ * Make the label ATK_RELATON_LABEL_FOR for the size list as well.
+ */
+ AtkObject *atk_label;
+ AtkRelationSet *relation_set;
+ AtkRelation *relation;
+ AtkObject *obj_array[1];
+
+ atk_label = gtk_widget_get_accessible (label);
+ relation_set = atk_object_ref_relation_set (atk_obj);
+ relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABELLED_BY);
+ if (relation)
+ {
+ atk_relation_add_target (relation, atk_label);
+ }
+ else
+ {
+ obj_array[0] = atk_label;
+ relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABELLED_BY);
+ atk_relation_set_add (relation_set, relation);
+ }
+ g_object_unref (relation_set);
+
+ relation_set = atk_object_ref_relation_set (atk_label);
+ relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABEL_FOR);
+ if (relation)
+ {
+ atk_relation_add_target (relation, atk_obj);
+ }
+ else
+ {
+ obj_array[0] = atk_obj;
+ relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABEL_FOR);
+ atk_relation_set_add (relation_set, relation);
+ }
+ g_object_unref (relation_set);
+ }
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_widget_show (vbox);
+ gtk_box_pack_start (GTK_BOX (fontsel), vbox, FALSE, TRUE, 0);
+
+ /* create the text entry widget */
+ label = gtk_label_new_with_mnemonic (_("_Preview:"));
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
+
+ text_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (text_box);
+ gtk_box_pack_start (GTK_BOX (vbox), text_box, FALSE, TRUE, 0);
+
+ priv->preview_entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->preview_entry);
+ gtk_entry_set_text (GTK_ENTRY (priv->preview_entry), _(PREVIEW_TEXT));
+
+ gtk_widget_show (priv->preview_entry);
+ g_signal_connect (priv->preview_entry, "changed",
+ G_CALLBACK (gtk_font_selection_preview_changed), fontsel);
+ gtk_widget_set_size_request (priv->preview_entry,
+ -1, INITIAL_PREVIEW_HEIGHT);
+ gtk_box_pack_start (GTK_BOX (text_box), priv->preview_entry,
+ TRUE, TRUE, 0);
+ gtk_widget_pop_composite_child();
+}
+
+/**
+ * gtk_font_selection_new:
+ *
+ * Creates a new #GtkFontSelection.
+ *
+ * Return value: a n ew #GtkFontSelection
+ */
+GtkWidget *
+gtk_font_selection_new (void)
+{
+ GtkFontSelection *fontsel;
+
+ fontsel = g_object_new (GTK_TYPE_FONT_SELECTION, NULL);
+
+ return GTK_WIDGET (fontsel);
+}
+
+static void
+gtk_font_selection_finalize (GObject *object)
+{
+ GtkFontSelection *fontsel = GTK_FONT_SELECTION (object);
+
+ gtk_font_selection_ref_family (fontsel, NULL);
+ gtk_font_selection_ref_face (fontsel, NULL);
+
+ G_OBJECT_CLASS (gtk_font_selection_parent_class)->finalize (object);
+}
+
+static void
+gtk_font_selection_ref_family (GtkFontSelection *fontsel,
+ PangoFontFamily *family)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+
+ if (family)
+ family = g_object_ref (family);
+ if (priv->family)
+ g_object_unref (priv->family);
+ priv->family = family;
+}
+
+static void gtk_font_selection_ref_face (GtkFontSelection *fontsel,
+ PangoFontFace *face)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+
+ if (face)
+ face = g_object_ref (face);
+ if (priv->face)
+ g_object_unref (priv->face);
+ priv->face = face;
+}
+
+static void
+gtk_font_selection_reload_fonts (GtkFontSelection *fontsel)
+{
+ if (gtk_widget_has_screen (GTK_WIDGET (fontsel)))
+ {
+ PangoFontDescription *desc;
+ desc = gtk_font_selection_get_font_description (fontsel);
+
+ gtk_font_selection_show_available_fonts (fontsel);
+ gtk_font_selection_show_available_sizes (fontsel, TRUE);
+ gtk_font_selection_show_available_styles (fontsel);
+
+ gtk_font_selection_select_font_desc (fontsel, desc, NULL, NULL);
+ gtk_font_selection_scroll_to_selection (fontsel);
+
+ pango_font_description_free (desc);
+ }
+}
+
+static void
+gtk_font_selection_screen_changed (GtkWidget *widget,
+ GdkScreen *previous_screen)
+{
+ gtk_font_selection_reload_fonts (GTK_FONT_SELECTION (widget));
+}
+
+static void
+gtk_font_selection_style_updated (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (gtk_font_selection_parent_class)->style_updated (widget);
+
+ /* Maybe fonts where installed or removed... */
+ gtk_font_selection_reload_fonts (GTK_FONT_SELECTION (widget));
+}
+
+static void
+gtk_font_selection_preview_changed (GtkWidget *entry,
+ GtkFontSelection *fontsel)
+{
+ g_object_notify (G_OBJECT (fontsel), "preview-text");
+}
+
+static void
+scroll_to_selection (GtkTreeView *tree_view)
+{
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
+ gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5, 0.5);
+ gtk_tree_path_free (path);
+ }
+}
+
+static void
+set_cursor_to_iter (GtkTreeView *view,
+ GtkTreeIter *iter)
+{
+ GtkTreeModel *model = gtk_tree_view_get_model (view);
+ GtkTreePath *path = gtk_tree_model_get_path (model, iter);
+
+ gtk_tree_view_set_cursor (view, path, NULL, FALSE);
+
+ gtk_tree_path_free (path);
+}
+
+static void
+gtk_font_selection_scroll_to_selection (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+
+ /* Try to scroll the font family list to the selected item */
+ scroll_to_selection (GTK_TREE_VIEW (priv->family_list));
+
+ /* Try to scroll the font family list to the selected item */
+ scroll_to_selection (GTK_TREE_VIEW (priv->face_list));
+
+ /* Try to scroll the font family list to the selected item */
+ scroll_to_selection (GTK_TREE_VIEW (priv->size_list));
+/* This is called when the list is mapped. Here we scroll to the current
+ font if necessary. */
+}
+
+static void
+gtk_font_selection_scroll_on_map (GtkWidget *widget,
+ gpointer data)
+{
+ gtk_font_selection_scroll_to_selection (GTK_FONT_SELECTION (data));
+}
+
+/* This is called when a family is selected in the list. */
+static void
+gtk_font_selection_select_font (GtkTreeSelection *selection,
+ gpointer data)
+{
+ GtkFontSelection *fontsel;
+ GtkFontSelectionPrivate *priv;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+#ifdef INCLUDE_FONT_ENTRIES
+ const gchar *family_name;
+#endif
+
+ fontsel = GTK_FONT_SELECTION (data);
+ priv = fontsel->priv;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ PangoFontFamily *family;
+
+ gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
+ if (priv->family != family)
+ {
+ gtk_font_selection_ref_family (fontsel, family);
+
+#ifdef INCLUDE_FONT_ENTRIES
+ family_name = pango_font_family_get_name (priv->family);
+ gtk_entry_set_text (GTK_ENTRY (priv->font_entry), family_name);
+#endif
+
+ gtk_font_selection_show_available_styles (fontsel);
+ gtk_font_selection_select_best_style (fontsel, TRUE);
+ }
+
+ g_object_unref (family);
+ }
+}
+
+static int
+cmp_families (const void *a, const void *b)
+{
+ const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
+ const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
+
+ return g_utf8_collate (a_name, b_name);
+}
+
+static void
+gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ GtkListStore *model;
+ PangoFontFamily **families;
+ PangoFontFamily *match_family = NULL;
+ gint n_families, i;
+ GtkTreeIter match_row;
+
+ model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->family_list)));
+
+ pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)),
+ &families, &n_families);
+ qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
+
+ gtk_list_store_clear (model);
+
+ for (i=0; i<n_families; i++)
+ {
+ const gchar *name = pango_font_family_get_name (families[i]);
+ GtkTreeIter iter;
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter,
+ FAMILY_COLUMN, families[i],
+ FAMILY_NAME_COLUMN, name,
+ -1);
+
+ if (i == 0 || !g_ascii_strcasecmp (name, "sans"))
+ {
+ match_family = families[i];
+ match_row = iter;
+ }
+ }
+
+ gtk_font_selection_ref_family (fontsel, match_family);
+ if (match_family)
+ {
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->family_list), &match_row);
+#ifdef INCLUDE_FONT_ENTRIES
+ gtk_entry_set_text (GTK_ENTRY (priv->font_entry),
+ pango_font_family_get_name (match_family));
+#endif /* INCLUDE_FONT_ENTRIES */
+ }
+
+ g_free (families);
+}
+
+static int
+compare_font_descriptions (const PangoFontDescription *a, const PangoFontDescription *b)
+{
+ int val = strcmp (pango_font_description_get_family (a), pango_font_description_get_family (b));
+ if (val != 0)
+ return val;
+
+ if (pango_font_description_get_weight (a) != pango_font_description_get_weight (b))
+ return pango_font_description_get_weight (a) - pango_font_description_get_weight (b);
+
+ if (pango_font_description_get_style (a) != pango_font_description_get_style (b))
+ return pango_font_description_get_style (a) - pango_font_description_get_style (b);
+
+ if (pango_font_description_get_stretch (a) != pango_font_description_get_stretch (b))
+ return pango_font_description_get_stretch (a) - pango_font_description_get_stretch (b);
+
+ if (pango_font_description_get_variant (a) != pango_font_description_get_variant (b))
+ return pango_font_description_get_variant (a) - pango_font_description_get_variant (b);
+
+ return 0;
+}
+
+static int
+faces_sort_func (const void *a, const void *b)
+{
+ PangoFontDescription *desc_a = pango_font_face_describe (*(PangoFontFace **)a);
+ PangoFontDescription *desc_b = pango_font_face_describe (*(PangoFontFace **)b);
+
+ int ord = compare_font_descriptions (desc_a, desc_b);
+
+ pango_font_description_free (desc_a);
+ pango_font_description_free (desc_b);
+
+ return ord;
+}
+
+static gboolean
+font_description_style_equal (const PangoFontDescription *a,
+ const PangoFontDescription *b)
+{
+ return (pango_font_description_get_weight (a) == pango_font_description_get_weight (b) &&
+ pango_font_description_get_style (a) == pango_font_description_get_style (b) &&
+ pango_font_description_get_stretch (a) == pango_font_description_get_stretch (b) &&
+ pango_font_description_get_variant (a) == pango_font_description_get_variant (b));
+}
+
+/* This fills the font style list with all the possible style combinations
+ for the current font family. */
+static void
+gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ gint n_faces, i;
+ PangoFontFace **faces;
+ PangoFontDescription *old_desc;
+ GtkListStore *model;
+ GtkTreeIter match_row;
+ PangoFontFace *match_face = NULL;
+
+ model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list)));
+
+ if (priv->face)
+ old_desc = pango_font_face_describe (priv->face);
+ else
+ old_desc= NULL;
+
+ pango_font_family_list_faces (priv->family, &faces, &n_faces);
+ qsort (faces, n_faces, sizeof (PangoFontFace *), faces_sort_func);
+
+ gtk_list_store_clear (model);
+
+ for (i=0; i < n_faces; i++)
+ {
+ GtkTreeIter iter;
+ const gchar *str = pango_font_face_get_face_name (faces[i]);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter,
+ FACE_COLUMN, faces[i],
+ FACE_NAME_COLUMN, str,
+ -1);
+
+ if (i == 0)
+ {
+ match_row = iter;
+ match_face = faces[i];
+ }
+ else if (old_desc)
+ {
+ PangoFontDescription *tmp_desc = pango_font_face_describe (faces[i]);
+
+ if (font_description_style_equal (tmp_desc, old_desc))
+ {
+ match_row = iter;
+ match_face = faces[i];
+ }
+
+ pango_font_description_free (tmp_desc);
+ }
+ }
+
+ if (old_desc)
+ pango_font_description_free (old_desc);
+
+ gtk_font_selection_ref_face (fontsel, match_face);
+ if (match_face)
+ {
+#ifdef INCLUDE_FONT_ENTRIES
+ const gchar *str = pango_font_face_get_face_name (priv->face);
+
+ gtk_entry_set_text (GTK_ENTRY (priv->font_style_entry), str);
+#endif
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &match_row);
+ }
+
+ g_free (faces);
+}
+
+/* This selects a style when the user selects a font. It just uses the first
+ available style at present. I was thinking of trying to maintain the
+ selected style, e.g. bold italic, when the user selects different fonts.
+ However, the interface is so easy to use now I'm not sure it's worth it.
+ Note: This will load a font. */
+static void
+gtk_font_selection_select_best_style (GtkFontSelection *fontsel,
+ gboolean use_first)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list));
+
+ if (gtk_tree_model_get_iter_first (model, &iter))
+ {
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &iter);
+ scroll_to_selection (GTK_TREE_VIEW (priv->face_list));
+ }
+
+ gtk_font_selection_show_available_sizes (fontsel, FALSE);
+ gtk_font_selection_select_best_size (fontsel);
+}
+
+
+/* This is called when a style is selected in the list. */
+static void
+gtk_font_selection_select_style (GtkTreeSelection *selection,
+ gpointer data)
+{
+ GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ PangoFontFace *face;
+
+ gtk_tree_model_get (model, &iter, FACE_COLUMN, &face, -1);
+ gtk_font_selection_ref_face (fontsel, face);
+ g_object_unref (face);
+ }
+
+ gtk_font_selection_show_available_sizes (fontsel, FALSE);
+ gtk_font_selection_select_best_size (fontsel);
+}
+
+static void
+gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
+ gboolean first_time)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ gint i;
+ GtkListStore *model;
+ gchar buffer[128];
+ gchar *p;
+
+ model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->size_list)));
+
+ /* Insert the standard font sizes */
+ if (first_time)
+ {
+ gtk_list_store_clear (model);
+
+ for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
+ {
+ GtkTreeIter iter;
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, SIZE_COLUMN, font_sizes[i], -1);
+
+ if (font_sizes[i] * PANGO_SCALE == priv->size)
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->size_list), &iter);
+ }
+ }
+ else
+ {
+ GtkTreeIter iter;
+ gboolean found = FALSE;
+
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter);
+ for (i = 0; i < G_N_ELEMENTS (font_sizes) && !found; i++)
+ {
+ if (font_sizes[i] * PANGO_SCALE == priv->size)
+ {
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->size_list), &iter);
+ found = TRUE;
+ }
+
+ gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter);
+ }
+
+ if (!found)
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list));
+ gtk_tree_selection_unselect_all (selection);
+ }
+ }
+
+ /* Set the entry to the new size, rounding to 1 digit,
+ * trimming of trailing 0's and a trailing period
+ */
+ g_snprintf (buffer, sizeof (buffer), "%.1f", priv->size / (1.0 * PANGO_SCALE));
+ if (strchr (buffer, '.'))
+ {
+ p = buffer + strlen (buffer) - 1;
+ while (*p == '0')
+ p--;
+ if (*p == '.')
+ p--;
+ p[1] = '\0';
+ }
+
+ /* Compare, to avoid moving the cursor unecessarily */
+ if (strcmp (gtk_entry_get_text (GTK_ENTRY (priv->size_entry)), buffer) != 0)
+ gtk_entry_set_text (GTK_ENTRY (priv->size_entry), buffer);
+}
+
+static void
+gtk_font_selection_select_best_size (GtkFontSelection *fontsel)
+{
+ gtk_font_selection_load_font (fontsel);
+}
+
+static void
+gtk_font_selection_set_size (GtkFontSelection *fontsel,
+ gint new_size)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+
+ if (priv->size != new_size)
+ {
+ priv->size = new_size;
+
+ gtk_font_selection_show_available_sizes (fontsel, FALSE);
+ gtk_font_selection_load_font (fontsel);
+ }
+}
+
+/* If the user hits return in the font size entry, we change to the new font
+ size. */
+static void
+gtk_font_selection_size_activate (GtkWidget *w,
+ gpointer data)
+{
+ GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ gint new_size;
+ const gchar *text;
+
+ text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
+ new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
+
+ if (priv->size != new_size)
+ gtk_font_selection_set_size (fontsel, new_size);
+ else
+ list_row_activated (w);
+}
+
+static gboolean
+gtk_font_selection_size_focus_out (GtkWidget *w,
+ GdkEventFocus *event,
+ gpointer data)
+{
+ GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ gint new_size;
+ const gchar *text;
+
+ text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
+ new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
+
+ gtk_font_selection_set_size (fontsel, new_size);
+
+ return TRUE;
+}
+
+/* This is called when a size is selected in the list. */
+static void
+gtk_font_selection_select_size (GtkTreeSelection *selection,
+ gpointer data)
+{
+ GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint new_size;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
+ gtk_font_selection_set_size (fontsel, new_size * PANGO_SCALE);
+ }
+}
+
+static void
+gtk_font_selection_load_font (GtkFontSelection *fontsel)
+{
+ gtk_font_selection_update_preview (fontsel);
+}
+
+static PangoFontDescription *
+gtk_font_selection_get_font_description (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ PangoFontDescription *font_desc;
+
+ if (priv->face)
+ {
+ font_desc = pango_font_face_describe (priv->face);
+ pango_font_description_set_size (font_desc, priv->size);
+ }
+ else
+ font_desc = pango_font_description_from_string (DEFAULT_FONT_NAME);
+
+ return font_desc;
+}
+
+/* This sets the font in the preview entry to the selected font,
+ * and tries to make sure that the preview entry is a reasonable
+ * size, i.e. so that the text can be seen with a bit of space to
+ * spare. But it tries to avoid resizing the entry every time the
+ * font changes. This also used to shrink the preview if the font
+ * size was decreased, but that made it awkward if the user wanted
+ * to resize the window themself.
+ */
+static void
+gtk_font_selection_update_preview (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ gint new_height;
+ GtkRequisition old_requisition, new_requisition;
+ GtkWidget *preview_entry = priv->preview_entry;
+ const gchar *text;
+
+ gtk_widget_get_preferred_size (preview_entry, &old_requisition, NULL);
+
+ gtk_widget_override_font (preview_entry,
+ gtk_font_selection_get_font_description (fontsel));
+
+ gtk_widget_get_preferred_size (preview_entry, &new_requisition, NULL);
+
+ /* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
+ new_height = CLAMP (new_requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
+
+ if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
+ gtk_widget_set_size_request (preview_entry, -1, new_height);
+
+ /* This sets the preview text, if it hasn't been set already. */
+ text = gtk_entry_get_text (GTK_ENTRY (preview_entry));
+ if (strlen (text) == 0)
+ gtk_entry_set_text (GTK_ENTRY (preview_entry), _(PREVIEW_TEXT));
+ gtk_editable_set_position (GTK_EDITABLE (preview_entry), 0);
+}
+
+
+/*****************************************************************************
+ * These functions are the main public interface for getting/setting the font.
+ *****************************************************************************/
+
+/**
+ * gtk_font_selection_get_family_list:
+ * @fontsel: a #GtkFontSelection
+ *
+ * This returns the #GtkTreeView that lists font families, for
+ * example, 'Sans', 'Serif', etc.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+GtkWidget *
+gtk_font_selection_get_family_list (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->family_list;
+}
+
+/**
+ * gtk_font_selection_get_face_list:
+ * @fontsel: a #GtkFontSelection
+ *
+ * This returns the #GtkTreeView which lists all styles available for
+ * the selected font. For example, 'Regular', 'Bold', etc.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+GtkWidget *
+gtk_font_selection_get_face_list (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->face_list;
+}
+
+/**
+ * gtk_font_selection_get_size_entry:
+ * @fontsel: a #GtkFontSelection
+ *
+ * This returns the #GtkEntry used to allow the user to edit the font
+ * number manually instead of selecting it from the list of font sizes.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+GtkWidget *
+gtk_font_selection_get_size_entry (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->size_entry;
+}
+
+/**
+ * gtk_font_selection_get_size_list:
+ * @fontsel: a #GtkFontSelection
+ *
+ * This returns the #GtkTreeeView used to list font sizes.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+GtkWidget *
+gtk_font_selection_get_size_list (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->size_list;
+}
+
+/**
+ * gtk_font_selection_get_preview_entry:
+ * @fontsel: a #GtkFontSelection
+ *
+ * This returns the #GtkEntry used to display the font as a preview.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+GtkWidget *
+gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->preview_entry;
+}
+
+/**
+ * gtk_font_selection_get_family:
+ * @fontsel: a #GtkFontSelection
+ *
+ * Gets the #PangoFontFamily representing the selected font family.
+ *
+ * Return value: (transfer none): A #PangoFontFamily representing the
+ * selected font family. Font families are a collection of font
+ * faces. The returned object is owned by @fontsel and must not
+ * be modified or freed.
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+PangoFontFamily *
+gtk_font_selection_get_family (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->family;
+}
+
+/**
+ * gtk_font_selection_get_face:
+ * @fontsel: a #GtkFontSelection
+ *
+ * Gets the #PangoFontFace representing the selected font group
+ * details (i.e. family, slant, weight, width, etc).
+ *
+ * Return value: (transfer none): A #PangoFontFace representing the
+ * selected font group details. The returned object is owned by
+ * @fontsel and must not be modified or freed.
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+PangoFontFace *
+gtk_font_selection_get_face (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ return fontsel->priv->face;
+}
+
+/**
+ * gtk_font_selection_get_size:
+ * @fontsel: a #GtkFontSelection
+ *
+ * The selected font size.
+ *
+ * Return value: A n integer representing the selected font size,
+ * or -1 if no font size is selected.
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ **/
+gint
+gtk_font_selection_get_size (GtkFontSelection *fontsel)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), -1);
+
+ return fontsel->priv->size;
+}
+
+/**
+ * gtk_font_selection_get_font_name:
+ * @fontsel: a #GtkFontSelection
+ *
+ * Gets the currently-selected font name.
+ *
+ * Note that this can be a different string than what you set with
+ * gtk_font_selection_set_font_name(), as the font selection widget may
+ * normalize font names and thus return a string with a different structure.
+ * For example, "Helvetica Italic Bold 12" could be normalized to
+ * "Helvetica Bold Italic 12". Use pango_font_description_equal()
+ * if you want to compare two font descriptions.
+ *
+ * Return value: A string with the name of the current font, or %NULL if
+ * no font is selected. You must free this string with g_free().
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+gchar *
+gtk_font_selection_get_font_name (GtkFontSelection *fontsel)
+{
+ gchar *result;
+
+ PangoFontDescription *font_desc = gtk_font_selection_get_font_description (fontsel);
+ result = pango_font_description_to_string (font_desc);
+ pango_font_description_free (font_desc);
+
+ return result;
+}
+
+/* This selects the appropriate list rows.
+ First we check the fontname is valid and try to find the font family
+ - i.e. the name in the main list. If we can't find that, then just return.
+ Next we try to set each of the properties according to the fontname.
+ Finally we select the font family & style in the lists. */
+static gboolean
+gtk_font_selection_select_font_desc (GtkFontSelection *fontsel,
+ PangoFontDescription *new_desc,
+ PangoFontFamily **pfamily,
+ PangoFontFace **pface)
+{
+ GtkFontSelectionPrivate *priv = fontsel->priv;
+ PangoFontFamily *new_family = NULL;
+ PangoFontFace *new_face = NULL;
+ PangoFontFace *fallback_face = NULL;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeIter match_iter;
+ gboolean valid;
+ const gchar *new_family_name;
+
+ new_family_name = pango_font_description_get_family (new_desc);
+
+ if (!new_family_name)
+ return FALSE;
+
+ /* Check to make sure that this is in the list of allowed fonts
+ */
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->family_list));
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next (model, &iter))
+ {
+ PangoFontFamily *family;
+
+ gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
+
+ if (g_ascii_strcasecmp (pango_font_family_get_name (family),
+ new_family_name) == 0)
+ new_family = g_object_ref (family);
+
+ g_object_unref (family);
+
+ if (new_family)
+ break;
+ }
+
+ if (!new_family)
+ return FALSE;
+
+ if (pfamily)
+ *pfamily = new_family;
+ else
+ g_object_unref (new_family);
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->family_list), &iter);
+ gtk_font_selection_show_available_styles (fontsel);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list));
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next (model, &iter))
+ {
+ PangoFontFace *face;
+ PangoFontDescription *tmp_desc;
+
+ gtk_tree_model_get (model, &iter, FACE_COLUMN, &face, -1);
+ tmp_desc = pango_font_face_describe (face);
+
+ if (font_description_style_equal (tmp_desc, new_desc))
+ new_face = g_object_ref (face);
+
+ if (!fallback_face)
+ {
+ fallback_face = g_object_ref (face);
+ match_iter = iter;
+ }
+
+ pango_font_description_free (tmp_desc);
+ g_object_unref (face);
+
+ if (new_face)
+ {
+ match_iter = iter;
+ break;
+ }
+ }
+
+ if (!new_face)
+ new_face = fallback_face;
+ else if (fallback_face)
+ g_object_unref (fallback_face);
+
+ if (pface)
+ *pface = new_face;
+ else if (new_face)
+ g_object_unref (new_face);
+ set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &match_iter);
+
+ gtk_font_selection_set_size (fontsel, pango_font_description_get_size (new_desc));
+
+ return TRUE;
+}
+
+
+/* This sets the current font, then selecting the appropriate list rows. */
+
+/**
+ * gtk_font_selection_set_font_name:
+ * @fontsel: a #GtkFontSelection
+ * @fontname: a font name like "Helvetica 12" or "Times Bold 18"
+ *
+ * Sets the currently-selected font.
+ *
+ * Note that the @fontsel needs to know the screen in which it will appear
+ * for this to work; this can be guaranteed by simply making sure that the
+ * @fontsel is inserted in a toplevel window before you call this function.
+ *
+ * Return value: %TRUE if the font could be set successfully; %FALSE if no
+ * such font exists or if the @fontsel doesn't belong to a particular
+ * screen yet.
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+gboolean
+gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
+ const gchar *fontname)
+{
+ PangoFontFamily *family = NULL;
+ PangoFontFace *face = NULL;
+ PangoFontDescription *new_desc;
+
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), FALSE);
+
+ if (!gtk_widget_has_screen (GTK_WIDGET (fontsel)))
+ return FALSE;
+
+ new_desc = pango_font_description_from_string (fontname);
+
+ if (gtk_font_selection_select_font_desc (fontsel, new_desc, &family, &face))
+ {
+ gtk_font_selection_ref_family (fontsel, family);
+ if (family)
+ g_object_unref (family);
+
+ gtk_font_selection_ref_face (fontsel, face);
+ if (face)
+ g_object_unref (face);
+ }
+
+ pango_font_description_free (new_desc);
+
+ g_object_notify (G_OBJECT (fontsel), "font-name");
+
+ return TRUE;
+}
+
+/**
+ * gtk_font_selection_get_preview_text:
+ * @fontsel: a #GtkFontSelection
+ *
+ * Gets the text displayed in the preview area.
+ *
+ * Return value: the text displayed in the preview area.
+ * This string is owned by the widget and should not be
+ * modified or freed
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+const gchar*
+gtk_font_selection_get_preview_text (GtkFontSelection *fontsel)
+{
+ GtkFontSelectionPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
+
+ priv = fontsel->priv;
+
+ return gtk_entry_get_text (GTK_ENTRY (priv->preview_entry));
+}
+
+
+/**
+ * gtk_font_selection_set_preview_text:
+ * @fontsel: a #GtkFontSelection
+ * @text: the text to display in the preview area
+ *
+ * Sets the text displayed in the preview area.
+ * The @text is used to show how the selected font looks.
+ *
+ * Deprecated: 3.2: Use #GtkFontChooser
+ */
+void
+gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
+ const gchar *text)
+{
+ GtkFontSelectionPrivate *priv;
+
+ g_return_if_fail (GTK_IS_FONT_SELECTION (fontsel));
+ g_return_if_fail (text != NULL);
+
+ priv = fontsel->priv;
+
+ gtk_entry_set_text (GTK_ENTRY (priv->preview_entry), text);
+}
+
+
+/**
+ * SECTION:gtkfontseldlg
+ * @Short_description: A dialog box for selecting fonts
+ * @Title: GtkFontSelectionDialog
+ * @See_also: #GtkFontSelection, #GtkDialog, #GtkFontChooserDialog
+ *
+ * The #GtkFontSelectionDialog widget is a dialog box for selecting a font.
+ *
+ * To set the font which is initially selected, use
+ * gtk_font_selection_dialog_set_font_name().
+ *
+ * To get the selected font use gtk_font_selection_dialog_get_font_name().
+ *
+ * To change the text which is shown in the preview area, use
+ * gtk_font_selection_dialog_set_preview_text().
+ *
+ * In GTK+ 3.2, #GtkFontSelectionDialog has been deprecated in favor of
+ * #GtkFontChooserDialog.
+ *
+ * <refsect2 id="GtkFontSelectionDialog-BUILDER-UI">
+ * <title>GtkFontSelectionDialog as GtkBuildable</title>
+ * The GtkFontSelectionDialog implementation of the GtkBuildable interface
+ * exposes the embedded #GtkFontSelection as internal child with the
+ * name "font_selection". It also exposes the buttons with the names
+ * "ok_button", "cancel_button" and "apply_button".
+ * </refsect2>
+ */
+
+static void gtk_font_selection_dialog_buildable_interface_init (GtkBuildableIface *iface);
+static GObject * gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname);
+
+G_DEFINE_TYPE_WITH_CODE (GtkFontSelectionDialog, gtk_font_selection_dialog,
+ GTK_TYPE_DIALOG,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_font_selection_dialog_buildable_interface_init))
+
+static GtkBuildableIface *parent_buildable_iface;
+
+static void
+gtk_font_selection_dialog_class_init (GtkFontSelectionDialogClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FONT_CHOOSER);
+
+ g_type_class_add_private (klass, sizeof (GtkFontSelectionDialogPrivate));
+}
+
+static void
+gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
+{
+ GtkFontSelectionDialogPrivate *priv;
+ GtkDialog *dialog = GTK_DIALOG (fontseldiag);
+ GtkWidget *action_area, *content_area;
+
+ fontseldiag->priv = G_TYPE_INSTANCE_GET_PRIVATE (fontseldiag,
+ GTK_TYPE_FONT_SELECTION_DIALOG,
+ GtkFontSelectionDialogPrivate);
+ priv = fontseldiag->priv;
+
+ content_area = gtk_dialog_get_content_area (dialog);
+ action_area = gtk_dialog_get_action_area (dialog);
+
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
+
+ gtk_widget_push_composite_child ();
+
+ gtk_window_set_resizable (GTK_WINDOW (fontseldiag), TRUE);
+
+ /* Create the content area */
+ priv->fontsel = gtk_font_selection_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (priv->fontsel), 5);
+ gtk_widget_show (priv->fontsel);
+ gtk_box_pack_start (GTK_BOX (content_area),
+ priv->fontsel, TRUE, TRUE, 0);
+
+ /* Create the action area */
+ priv->cancel_button = gtk_dialog_add_button (dialog,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL);
+
+ priv->apply_button = gtk_dialog_add_button (dialog,
+ GTK_STOCK_APPLY,
+ GTK_RESPONSE_APPLY);
+ gtk_widget_hide (priv->apply_button);
+
+ priv->ok_button = gtk_dialog_add_button (dialog,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_OK);
+ gtk_widget_grab_default (priv->ok_button);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontseldiag),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_APPLY,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gtk_window_set_title (GTK_WINDOW (fontseldiag),
+ _("Font Selection"));
+
+ gtk_widget_pop_composite_child ();
+}
+
+/**
+ * gtk_font_selection_dialog_new:
+ * @title: the title of the dialog window
+ *
+ * Creates a new #GtkFontSelectionDialog.
+ *
+ * Return value: a new #GtkFontSelectionDialog
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+GtkWidget*
+gtk_font_selection_dialog_new (const gchar *title)
+{
+ GtkFontSelectionDialog *fontseldiag;
+
+ fontseldiag = g_object_new (GTK_TYPE_FONT_SELECTION_DIALOG, NULL);
+
+ if (title)
+ gtk_window_set_title (GTK_WINDOW (fontseldiag), title);
+
+ return GTK_WIDGET (fontseldiag);
+}
+
+/**
+ * gtk_font_selection_dialog_get_font_selection:
+ * @fsd: a #GtkFontSelectionDialog
+ *
+ * Retrieves the #GtkFontSelection widget embedded in the dialog.
+ *
+ * Returns: (transfer none): the embedded #GtkFontSelection
+ *
+ * Since: 2.22
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ **/
+GtkWidget*
+gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
+
+ return fsd->priv->fontsel;
+}
+
+
+/**
+ * gtk_font_selection_dialog_get_ok_button:
+ * @fsd: a #GtkFontSelectionDialog
+ *
+ * Gets the 'OK' button.
+ *
+ * Return value: (transfer none): the #GtkWidget used in the dialog
+ * for the 'OK' button.
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+GtkWidget *
+gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
+
+ return fsd->priv->ok_button;
+}
+
+/**
+ * gtk_font_selection_dialog_get_cancel_button:
+ * @fsd: a #GtkFontSelectionDialog
+ *
+ * Gets the 'Cancel' button.
+ *
+ * Return value: (transfer none): the #GtkWidget used in the dialog
+ * for the 'Cancel' button.
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+GtkWidget *
+gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd)
+{
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
+
+ return fsd->priv->cancel_button;
+}
+
+static void
+gtk_font_selection_dialog_buildable_interface_init (GtkBuildableIface *iface)
+{
+ parent_buildable_iface = g_type_interface_peek_parent (iface);
+ iface->get_internal_child = gtk_font_selection_dialog_buildable_get_internal_child;
+}
+
+static GObject *
+gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname)
+{
+ GtkFontSelectionDialogPrivate *priv;
+
+ priv = GTK_FONT_SELECTION_DIALOG (buildable)->priv;
+
+ if (g_strcmp0 (childname, "ok_button") == 0)
+ return G_OBJECT (priv->ok_button);
+ else if (g_strcmp0 (childname, "cancel_button") == 0)
+ return G_OBJECT (priv->cancel_button);
+ else if (g_strcmp0 (childname, "apply_button") == 0)
+ return G_OBJECT (priv->apply_button);
+ else if (g_strcmp0 (childname, "font_selection") == 0)
+ return G_OBJECT (priv->fontsel);
+
+ return parent_buildable_iface->get_internal_child (buildable, builder, childname);
+}
+
+/**
+ * gtk_font_selection_dialog_get_font_name:
+ * @fsd: a #GtkFontSelectionDialog
+ *
+ * Gets the currently-selected font name.
+ *
+ * Note that this can be a different string than what you set with
+ * gtk_font_selection_dialog_set_font_name(), as the font selection widget
+ * may normalize font names and thus return a string with a different
+ * structure. For example, "Helvetica Italic Bold 12" could be normalized
+ * to "Helvetica Bold Italic 12". Use pango_font_description_equal()
+ * if you want to compare two font descriptions.
+ *
+ * Return value: A string with the name of the current font, or %NULL if no
+ * font is selected. You must free this string with g_free().
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+gchar*
+gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd)
+{
+ GtkFontSelectionDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
+
+ priv = fsd->priv;
+
+ return gtk_font_selection_get_font_name (GTK_FONT_SELECTION (priv->fontsel));
+}
+
+/**
+ * gtk_font_selection_dialog_set_font_name:
+ * @fsd: a #GtkFontSelectionDialog
+ * @fontname: a font name like "Helvetica 12" or "Times Bold 18"
+ *
+ * Sets the currently selected font.
+ *
+ * Return value: %TRUE if the font selected in @fsd is now the
+ * @fontname specified, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+gboolean
+gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
+ const gchar *fontname)
+{
+ GtkFontSelectionDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), FALSE);
+ g_return_val_if_fail (fontname, FALSE);
+
+ priv = fsd->priv;
+
+ return gtk_font_selection_set_font_name (GTK_FONT_SELECTION (priv->fontsel), fontname);
+}
+
+/**
+ * gtk_font_selection_dialog_get_preview_text:
+ * @fsd: a #GtkFontSelectionDialog
+ *
+ * Gets the text displayed in the preview area.
+ *
+ * Return value: the text displayed in the preview area.
+ * This string is owned by the widget and should not be
+ * modified or freed
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+const gchar*
+gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd)
+{
+ GtkFontSelectionDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
+
+ priv = fsd->priv;
+
+ return gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (priv->fontsel));
+}
+
+/**
+ * gtk_font_selection_dialog_set_preview_text:
+ * @fsd: a #GtkFontSelectionDialog
+ * @text: the text to display in the preview area
+ *
+ * Sets the text displayed in the preview area.
+ *
+ * Deprecated: 3.2: Use #GtkFontChooserDialog
+ */
+void
+gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
+ const gchar *text)
+{
+ GtkFontSelectionDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd));
+ g_return_if_fail (text != NULL);
+
+ priv = fsd->priv;
+
+ gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (priv->fontsel), text);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * GtkFontSelection widget for Gtk+, by Damon Chaplin, May 1998.
+ * Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
+ * The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_FONTSEL_H__
+#define __GTK_FONTSEL_H__
+
+
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkbox.h>
+
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_FONT_SELECTION (gtk_font_selection_get_type ())
+#define GTK_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelection))
+#define GTK_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
+#define GTK_IS_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION))
+#define GTK_IS_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION))
+#define GTK_FONT_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
+
+
+#define GTK_TYPE_FONT_SELECTION_DIALOG (gtk_font_selection_dialog_get_type ())
+#define GTK_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialog))
+#define GTK_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
+#define GTK_IS_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION_DIALOG))
+#define GTK_IS_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION_DIALOG))
+#define GTK_FONT_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
+
+
+typedef struct _GtkFontSelection GtkFontSelection;
+typedef struct _GtkFontSelectionPrivate GtkFontSelectionPrivate;
+typedef struct _GtkFontSelectionClass GtkFontSelectionClass;
+
+typedef struct _GtkFontSelectionDialog GtkFontSelectionDialog;
+typedef struct _GtkFontSelectionDialogPrivate GtkFontSelectionDialogPrivate;
+typedef struct _GtkFontSelectionDialogClass GtkFontSelectionDialogClass;
+
+struct _GtkFontSelection
+{
+ GtkBox parent_instance;
+
+ /*< private >*/
+ GtkFontSelectionPrivate *priv;
+};
+
+struct _GtkFontSelectionClass
+{
+ GtkBoxClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+
+struct _GtkFontSelectionDialog
+{
+ GtkDialog parent_instance;
+
+ /*< private >*/
+ GtkFontSelectionDialogPrivate *priv;
+};
+
+struct _GtkFontSelectionDialogClass
+{
+ GtkDialogClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+GType gtk_font_selection_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget * gtk_font_selection_new (void);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget * gtk_font_selection_get_family_list (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget * gtk_font_selection_get_face_list (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget * gtk_font_selection_get_size_entry (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget * gtk_font_selection_get_size_list (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget * gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+PangoFontFamily *
+ gtk_font_selection_get_family (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+PangoFontFace *
+ gtk_font_selection_get_face (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+gint gtk_font_selection_get_size (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+gchar* gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
+
+GDK_DEPRECATED_FOR(GtkFontChooser)
+gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
+ const gchar *fontname);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+const gchar* gtk_font_selection_get_preview_text (GtkFontSelection *fontsel);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+void gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
+ const gchar *text);
+
+
+GType gtk_font_selection_dialog_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget *gtk_font_selection_dialog_new (const gchar *title);
+
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget *gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget *gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+GtkWidget *gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+gchar* gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+gboolean gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
+ const gchar *fontname);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+const gchar*
+ gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd);
+GDK_DEPRECATED_FOR(GtkFontChooser)
+void gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
+ const gchar *text);
+
+G_END_DECLS
+
+
+#endif /* __GTK_FONTSEL_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ * Copyright (C) 1998 Elliot Lee
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
+#include "gtkhandlebox.h"
+#include "gtkinvisible.h"
+#include "gtkmain.h"
+#include "gtkmarshalers.h"
+#include "gtkwindow.h"
+#include "gtktypebuiltins.h"
+#include "gtkprivate.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtkhandlebox
+ * @Short_description: a widget for detachable window portions
+ * @Title: GtkHandleBox
+ *
+ * The #GtkHandleBox widget allows a portion of a window to be "torn
+ * off". It is a bin widget which displays its child and a handle that
+ * the user can drag to tear off a separate window (the <firstterm>float
+ * window</firstterm>) containing the child widget. A thin
+ * <firstterm>ghost</firstterm> is drawn in the original location of the
+ * handlebox. By dragging the separate window back to its original
+ * location, it can be reattached.
+ *
+ * When reattaching, the ghost and float window, must be aligned
+ * along one of the edges, the <firstterm>snap edge</firstterm>.
+ * This either can be specified by the application programmer
+ * explicitely, or GTK+ will pick a reasonable default based
+ * on the handle position.
+ *
+ * To make detaching and reattaching the handlebox as minimally confusing
+ * as possible to the user, it is important to set the snap edge so that
+ * the snap edge does not move when the handlebox is deattached. For
+ * instance, if the handlebox is packed at the bottom of a VBox, then
+ * when the handlebox is detached, the bottom edge of the handlebox's
+ * allocation will remain fixed as the height of the handlebox shrinks,
+ * so the snap edge should be set to %GTK_POS_BOTTOM.
+ *
+ * <note>
+ * #GtkHandleBox has been deprecated. It is very specialized, lacks features
+ * to make it useful and most importantly does not fit well into modern
+ * application design. Do not use it. There is no replacement.
+ * </note>
+ */
+
+
+struct _GtkHandleBoxPrivate
+{
+ /* Properties */
+ GtkPositionType handle_position;
+ GtkPositionType snap_edge;
+ GtkShadowType shadow_type;
+ gboolean child_detached;
+ /* Properties */
+
+ GtkAllocation attach_allocation;
+ GtkAllocation float_allocation;
+
+ GdkDevice *grab_device;
+
+ GdkWindow *bin_window; /* parent window for children */
+ GdkWindow *float_window;
+
+ /* Variables used during a drag
+ */
+ gint orig_x;
+ gint orig_y;
+
+ guint float_window_mapped : 1;
+ guint in_drag : 1;
+ guint shrink_on_detach : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_SHADOW_TYPE,
+ PROP_HANDLE_POSITION,
+ PROP_SNAP_EDGE,
+ PROP_SNAP_EDGE_SET,
+ PROP_CHILD_DETACHED
+};
+
+#define DRAG_HANDLE_SIZE 10
+#define CHILDLESS_SIZE 25
+#define GHOST_HEIGHT 3
+#define TOLERANCE 5
+
+enum {
+ SIGNAL_CHILD_ATTACHED,
+ SIGNAL_CHILD_DETACHED,
+ SIGNAL_LAST
+};
+
+/* The algorithm for docking and redocking implemented here
+ * has a couple of nice properties:
+ *
+ * 1) During a single drag, docking always occurs at the
+ * the same cursor position. This means that the users
+ * motions are reversible, and that you won't
+ * undock/dock oscillations.
+ *
+ * 2) Docking generally occurs at user-visible features.
+ * The user, once they figure out to redock, will
+ * have useful information about doing it again in
+ * the future.
+ *
+ * Please try to preserve these properties if you
+ * change the algorithm. (And the current algorithm
+ * is far from ideal). Briefly, the current algorithm
+ * for deciding whether the handlebox is docked or not:
+ *
+ * 1) The decision is done by comparing two rectangles - the
+ * allocation if the widget at the start of the drag,
+ * and the boundary of hb->bin_window at the start of
+ * of the drag offset by the distance that the cursor
+ * has moved.
+ *
+ * 2) These rectangles must have one edge, the "snap_edge"
+ * of the handlebox, aligned within TOLERANCE.
+ *
+ * 3) On the other dimension, the extents of one rectangle
+ * must be contained in the extents of the other,
+ * extended by tolerance. That is, either we can have:
+ *
+ * <-TOLERANCE-|--------bin_window--------------|-TOLERANCE->
+ * <--------float_window-------------------->
+ *
+ * or we can have:
+ *
+ * <-TOLERANCE-|------float_window--------------|-TOLERANCE->
+ * <--------bin_window-------------------->
+ */
+
+static void gtk_handle_box_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_handle_box_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gtk_handle_box_map (GtkWidget *widget);
+static void gtk_handle_box_unmap (GtkWidget *widget);
+static void gtk_handle_box_realize (GtkWidget *widget);
+static void gtk_handle_box_unrealize (GtkWidget *widget);
+static void gtk_handle_box_style_updated (GtkWidget *widget);
+static void gtk_handle_box_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+static void gtk_handle_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_handle_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_handle_box_size_allocate (GtkWidget *widget,
+ GtkAllocation *real_allocation);
+static void gtk_handle_box_add (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_handle_box_remove (GtkContainer *container,
+ GtkWidget *widget);
+static gboolean gtk_handle_box_draw (GtkWidget *widget,
+ cairo_t *cr);
+static gboolean gtk_handle_box_button_press (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gtk_handle_box_motion (GtkWidget *widget,
+ GdkEventMotion *event);
+static gboolean gtk_handle_box_delete_event (GtkWidget *widget,
+ GdkEventAny *event);
+static void gtk_handle_box_reattach (GtkHandleBox *hb);
+static void gtk_handle_box_end_drag (GtkHandleBox *hb,
+ guint32 time);
+
+static guint handle_box_signals[SIGNAL_LAST] = { 0 };
+
+G_DEFINE_TYPE (GtkHandleBox, gtk_handle_box, GTK_TYPE_BIN)
+
+static void
+gtk_handle_box_class_init (GtkHandleBoxClass *class)
+{
+ GObjectClass *gobject_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+
+ gobject_class = (GObjectClass *) class;
+ widget_class = (GtkWidgetClass *) class;
+ container_class = (GtkContainerClass *) class;
+
+ gobject_class->set_property = gtk_handle_box_set_property;
+ gobject_class->get_property = gtk_handle_box_get_property;
+
+ g_object_class_install_property (gobject_class,
+ PROP_SHADOW_TYPE,
+ g_param_spec_enum ("shadow-type",
+ P_("Shadow type"),
+ P_("Appearance of the shadow that surrounds the container"),
+ GTK_TYPE_SHADOW_TYPE,
+ GTK_SHADOW_OUT,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_HANDLE_POSITION,
+ g_param_spec_enum ("handle-position",
+ P_("Handle position"),
+ P_("Position of the handle relative to the child widget"),
+ GTK_TYPE_POSITION_TYPE,
+ GTK_POS_LEFT,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_SNAP_EDGE,
+ g_param_spec_enum ("snap-edge",
+ P_("Snap edge"),
+ P_("Side of the handlebox that's lined up with the docking point to dock the handlebox"),
+ GTK_TYPE_POSITION_TYPE,
+ GTK_POS_TOP,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_SNAP_EDGE_SET,
+ g_param_spec_boolean ("snap-edge-set",
+ P_("Snap edge set"),
+ P_("Whether to use the value from the snap_edge property or a value derived from handle_position"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_CHILD_DETACHED,
+ g_param_spec_boolean ("child-detached",
+ P_("Child Detached"),
+ P_("A boolean value indicating whether the handlebox's child is attached or detached."),
+ FALSE,
+ GTK_PARAM_READABLE));
+
+ widget_class->map = gtk_handle_box_map;
+ widget_class->unmap = gtk_handle_box_unmap;
+ widget_class->realize = gtk_handle_box_realize;
+ widget_class->unrealize = gtk_handle_box_unrealize;
+ widget_class->style_updated = gtk_handle_box_style_updated;
+ widget_class->get_preferred_width = gtk_handle_box_get_preferred_width;
+ widget_class->get_preferred_height = gtk_handle_box_get_preferred_height;
+ widget_class->size_allocate = gtk_handle_box_size_allocate;
+ widget_class->draw = gtk_handle_box_draw;
+ widget_class->button_press_event = gtk_handle_box_button_press;
+ widget_class->delete_event = gtk_handle_box_delete_event;
+
+ container_class->add = gtk_handle_box_add;
+ container_class->remove = gtk_handle_box_remove;
+
+ class->child_attached = NULL;
+ class->child_detached = NULL;
+
+ /**
+ * GtkHandleBox::child-attached:
+ * @handlebox: the object which received the signal.
+ * @widget: the child widget of the handlebox.
+ * (this argument provides no extra information
+ * and is here only for backwards-compatibility)
+ *
+ * This signal is emitted when the contents of the
+ * handlebox are reattached to the main window.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ */
+ handle_box_signals[SIGNAL_CHILD_ATTACHED] =
+ g_signal_new (I_("child-attached"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkHandleBoxClass, child_attached),
+ NULL, NULL,
+ _gtk_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
+
+ /**
+ * GtkHandleBox::child-detached:
+ * @handlebox: the object which received the signal.
+ * @widget: the child widget of the handlebox.
+ * (this argument provides no extra information
+ * and is here only for backwards-compatibility)
+ *
+ * This signal is emitted when the contents of the
+ * handlebox are detached from the main window.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ */
+ handle_box_signals[SIGNAL_CHILD_DETACHED] =
+ g_signal_new (I_("child-detached"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkHandleBoxClass, child_detached),
+ NULL, NULL,
+ _gtk_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
+
+ g_type_class_add_private (gobject_class, sizeof (GtkHandleBoxPrivate));
+}
+
+static void
+gtk_handle_box_init (GtkHandleBox *handle_box)
+{
+ GtkHandleBoxPrivate *priv;
+ GtkStyleContext *context;
+
+ handle_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (handle_box,
+ GTK_TYPE_HANDLE_BOX,
+ GtkHandleBoxPrivate);
+ priv = handle_box->priv;
+
+ gtk_widget_set_has_window (GTK_WIDGET (handle_box), TRUE);
+
+ priv->bin_window = NULL;
+ priv->float_window = NULL;
+ priv->shadow_type = GTK_SHADOW_OUT;
+ priv->handle_position = GTK_POS_LEFT;
+ priv->float_window_mapped = FALSE;
+ priv->child_detached = FALSE;
+ priv->in_drag = FALSE;
+ priv->shrink_on_detach = TRUE;
+ priv->snap_edge = -1;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (handle_box));
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_DOCK);
+}
+
+static void
+gtk_handle_box_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkHandleBox *handle_box = GTK_HANDLE_BOX (object);
+
+ switch (prop_id)
+ {
+ case PROP_SHADOW_TYPE:
+ gtk_handle_box_set_shadow_type (handle_box, g_value_get_enum (value));
+ break;
+ case PROP_HANDLE_POSITION:
+ gtk_handle_box_set_handle_position (handle_box, g_value_get_enum (value));
+ break;
+ case PROP_SNAP_EDGE:
+ gtk_handle_box_set_snap_edge (handle_box, g_value_get_enum (value));
+ break;
+ case PROP_SNAP_EDGE_SET:
+ if (!g_value_get_boolean (value))
+ gtk_handle_box_set_snap_edge (handle_box, (GtkPositionType)-1);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_handle_box_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkHandleBox *handle_box = GTK_HANDLE_BOX (object);
+ GtkHandleBoxPrivate *priv = handle_box->priv;
+
+ switch (prop_id)
+ {
+ case PROP_SHADOW_TYPE:
+ g_value_set_enum (value, priv->shadow_type);
+ break;
+ case PROP_HANDLE_POSITION:
+ g_value_set_enum (value, priv->handle_position);
+ break;
+ case PROP_SNAP_EDGE:
+ g_value_set_enum (value,
+ (priv->snap_edge == -1 ?
+ GTK_POS_TOP : priv->snap_edge));
+ break;
+ case PROP_SNAP_EDGE_SET:
+ g_value_set_boolean (value, priv->snap_edge != -1);
+ break;
+ case PROP_CHILD_DETACHED:
+ g_value_set_boolean (value, priv->child_detached);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/**
+ * gtk_handle_box_new:
+ *
+ * Create a new handle box.
+ *
+ * Returns: a new #GtkHandleBox.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ */
+GtkWidget*
+gtk_handle_box_new (void)
+{
+ return g_object_new (GTK_TYPE_HANDLE_BOX, NULL);
+}
+
+static void
+gtk_handle_box_map (GtkWidget *widget)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkBin *bin = GTK_BIN (widget);
+ GtkWidget *child;
+
+ gtk_widget_set_mapped (widget, TRUE);
+
+ child = gtk_bin_get_child (bin);
+ if (child != NULL &&
+ gtk_widget_get_visible (child) &&
+ !gtk_widget_get_mapped (child))
+ gtk_widget_map (child);
+
+ if (priv->child_detached && !priv->float_window_mapped)
+ {
+ gdk_window_show (priv->float_window);
+ priv->float_window_mapped = TRUE;
+ }
+
+ gdk_window_show (priv->bin_window);
+ gdk_window_show (gtk_widget_get_window (widget));
+}
+
+static void
+gtk_handle_box_unmap (GtkWidget *widget)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+
+ gtk_widget_set_mapped (widget, FALSE);
+
+ gdk_window_hide (gtk_widget_get_window (widget));
+ if (priv->float_window_mapped)
+ {
+ gdk_window_hide (priv->float_window);
+ priv->float_window_mapped = FALSE;
+ }
+
+ GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->unmap (widget);
+}
+
+static void
+gtk_handle_box_realize (GtkWidget *widget)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkAllocation allocation;
+ GtkRequisition requisition;
+ GtkStyleContext *context;
+ GtkWidget *child;
+ GdkWindow *window;
+ GdkWindowAttr attributes;
+ gint attributes_mask;
+
+ gtk_widget_set_realized (widget, TRUE);
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.event_mask = (gtk_widget_get_events (widget)
+ | GDK_EXPOSURE_MASK);
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
+
+ attributes.x = 0;
+ attributes.y = 0;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.event_mask = (gtk_widget_get_events (widget)
+ | GDK_EXPOSURE_MASK
+ | GDK_BUTTON1_MOTION_MASK
+ | GDK_POINTER_MOTION_HINT_MASK
+ | GDK_BUTTON_PRESS_MASK
+ | GDK_BUTTON_RELEASE_MASK);
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+
+ priv->bin_window = gdk_window_new (window,
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (priv->bin_window, widget);
+
+ child = gtk_bin_get_child (GTK_BIN (hb));
+ if (child)
+ gtk_widget_set_parent_window (child, priv->bin_window);
+
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
+
+ attributes.x = 0;
+ attributes.y = 0;
+ attributes.width = requisition.width;
+ attributes.height = requisition.height;
+ attributes.window_type = GDK_WINDOW_TOPLEVEL;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.event_mask = (gtk_widget_get_events (widget)
+ | GDK_KEY_PRESS_MASK
+ | GDK_ENTER_NOTIFY_MASK
+ | GDK_LEAVE_NOTIFY_MASK
+ | GDK_FOCUS_CHANGE_MASK
+ | GDK_STRUCTURE_MASK);
+ attributes.type_hint = GDK_WINDOW_TYPE_HINT_TOOLBAR;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_TYPE_HINT;
+ priv->float_window = gdk_window_new (gtk_widget_get_root_window (widget),
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (priv->float_window, widget);
+ gdk_window_set_decorations (priv->float_window, 0);
+ gdk_window_set_type_hint (priv->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_background (context, window);
+ gtk_style_context_set_background (context, priv->bin_window);
+ gtk_style_context_set_background (context, priv->float_window);
+}
+
+static void
+gtk_handle_box_unrealize (GtkWidget *widget)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+
+ gdk_window_set_user_data (priv->bin_window, NULL);
+ gdk_window_destroy (priv->bin_window);
+ priv->bin_window = NULL;
+ gdk_window_set_user_data (priv->float_window, NULL);
+ gdk_window_destroy (priv->float_window);
+ priv->float_window = NULL;
+
+ GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->unrealize (widget);
+}
+
+static void
+gtk_handle_box_style_updated (GtkWidget *widget)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+
+ GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->style_updated (widget);
+
+ if (gtk_widget_get_realized (widget) &&
+ gtk_widget_get_has_window (widget))
+ {
+ GtkStateFlags state;
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ gtk_style_context_set_background (context, gtk_widget_get_window (widget));
+ gtk_style_context_set_background (context, priv->bin_window);
+ gtk_style_context_set_background (context, priv->float_window);
+
+ gtk_style_context_restore (context);
+ }
+}
+
+static int
+effective_handle_position (GtkHandleBox *hb)
+{
+ GtkHandleBoxPrivate *priv = hb->priv;
+ int handle_position;
+
+ if (gtk_widget_get_direction (GTK_WIDGET (hb)) == GTK_TEXT_DIR_LTR)
+ handle_position = priv->handle_position;
+ else
+ {
+ switch (priv->handle_position)
+ {
+ case GTK_POS_LEFT:
+ handle_position = GTK_POS_RIGHT;
+ break;
+ case GTK_POS_RIGHT:
+ handle_position = GTK_POS_LEFT;
+ break;
+ default:
+ handle_position = priv->handle_position;
+ break;
+ }
+ }
+
+ return handle_position;
+}
+
+static void
+gtk_handle_box_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkRequisition child_requisition;
+ GtkWidget *child;
+ gint handle_position;
+
+ handle_position = effective_handle_position (hb);
+
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ {
+ requisition->width = DRAG_HANDLE_SIZE;
+ requisition->height = 0;
+ }
+ else
+ {
+ requisition->width = 0;
+ requisition->height = DRAG_HANDLE_SIZE;
+ }
+
+ child = gtk_bin_get_child (bin);
+ /* if our child is not visible, we still request its size, since we
+ * won't have any useful hint for our size otherwise.
+ */
+ if (child)
+ {
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
+ }
+ else
+ {
+ child_requisition.width = 0;
+ child_requisition.height = 0;
+ }
+
+ if (priv->child_detached)
+ {
+ /* FIXME: This doesn't work currently */
+ if (!priv->shrink_on_detach)
+ {
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ requisition->height += child_requisition.height;
+ else
+ requisition->width += child_requisition.width;
+ }
+ else
+ {
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder padding;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+ gtk_style_context_get_padding (context, state, &padding);
+
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ requisition->height += padding.top;
+ else
+ requisition->width += padding.left;
+ }
+ }
+ else
+ {
+ guint border_width;
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ requisition->width += border_width * 2;
+ requisition->height += border_width * 2;
+
+ if (child)
+ {
+ requisition->width += child_requisition.width;
+ requisition->height += child_requisition.height;
+ }
+ else
+ {
+ requisition->width += CHILDLESS_SIZE;
+ requisition->height += CHILDLESS_SIZE;
+ }
+ }
+}
+
+static void
+gtk_handle_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkRequisition requisition;
+
+ gtk_handle_box_size_request (widget, &requisition);
+
+ *minimum = *natural = requisition.width;
+}
+
+static void
+gtk_handle_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkRequisition requisition;
+
+ gtk_handle_box_size_request (widget, &requisition);
+
+ *minimum = *natural = requisition.height;
+}
+
+
+static void
+gtk_handle_box_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkRequisition child_requisition;
+ GtkWidget *child;
+ gint handle_position;
+
+ handle_position = effective_handle_position (hb);
+
+ child = gtk_bin_get_child (bin);
+
+ if (child)
+ {
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
+ }
+ else
+ {
+ child_requisition.width = 0;
+ child_requisition.height = 0;
+ }
+
+ gtk_widget_set_allocation (widget, allocation);
+
+ if (gtk_widget_get_realized (widget))
+ gdk_window_move_resize (gtk_widget_get_window (widget),
+ allocation->x, allocation->y,
+ allocation->width, allocation->height);
+
+ if (child != NULL && gtk_widget_get_visible (child))
+ {
+ GtkAllocation child_allocation;
+ guint border_width;
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ child_allocation.x = border_width;
+ child_allocation.y = border_width;
+ if (handle_position == GTK_POS_LEFT)
+ child_allocation.x += DRAG_HANDLE_SIZE;
+ else if (handle_position == GTK_POS_TOP)
+ child_allocation.y += DRAG_HANDLE_SIZE;
+
+ if (priv->child_detached)
+ {
+ guint float_width;
+ guint float_height;
+
+ child_allocation.width = child_requisition.width;
+ child_allocation.height = child_requisition.height;
+
+ float_width = child_allocation.width + 2 * border_width;
+ float_height = child_allocation.height + 2 * border_width;
+
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ float_width += DRAG_HANDLE_SIZE;
+ else
+ float_height += DRAG_HANDLE_SIZE;
+
+ if (gtk_widget_get_realized (widget))
+ {
+ gdk_window_resize (priv->float_window,
+ float_width,
+ float_height);
+ gdk_window_move_resize (priv->bin_window,
+ 0,
+ 0,
+ float_width,
+ float_height);
+ }
+ }
+ else
+ {
+ child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width);
+ child_allocation.height = MAX (1, (gint) allocation->height - 2 * border_width);
+
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ child_allocation.width -= DRAG_HANDLE_SIZE;
+ else
+ child_allocation.height -= DRAG_HANDLE_SIZE;
+
+ if (gtk_widget_get_realized (widget))
+ gdk_window_move_resize (priv->bin_window,
+ 0,
+ 0,
+ allocation->width,
+ allocation->height);
+ }
+
+ gtk_widget_size_allocate (child, &child_allocation);
+ }
+}
+
+static void
+gtk_handle_box_draw_ghost (GtkHandleBox *hb,
+ cairo_t *cr)
+{
+ GtkWidget *widget = GTK_WIDGET (hb);
+ GtkStateFlags state;
+ GtkStyleContext *context;
+ guint x;
+ guint y;
+ guint width;
+ guint height;
+ gint allocation_width;
+ gint allocation_height;
+ gint handle_position;
+
+ handle_position = effective_handle_position (hb);
+ allocation_width = gtk_widget_get_allocated_width (widget);
+ allocation_height = gtk_widget_get_allocated_height (widget);
+
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ {
+ x = handle_position == GTK_POS_LEFT ? 0 : allocation_width - DRAG_HANDLE_SIZE;
+ y = 0;
+ width = DRAG_HANDLE_SIZE;
+ height = allocation_height;
+ }
+ else
+ {
+ x = 0;
+ y = handle_position == GTK_POS_TOP ? 0 : allocation_height - DRAG_HANDLE_SIZE;
+ width = allocation_width;
+ height = DRAG_HANDLE_SIZE;
+ }
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ gtk_render_background (context, cr, x, y, width, height);
+ gtk_render_frame (context, cr, x, y, width, height);
+
+ if (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT)
+ gtk_render_line (context, cr,
+ handle_position == GTK_POS_LEFT ? DRAG_HANDLE_SIZE : 0,
+ allocation_height / 2,
+ handle_position == GTK_POS_LEFT ? allocation_width : allocation_width - DRAG_HANDLE_SIZE,
+ allocation_height / 2);
+ else
+ gtk_render_line (context, cr,
+ allocation_width / 2,
+ handle_position == GTK_POS_TOP ? DRAG_HANDLE_SIZE : 0,
+ allocation_width / 2,
+ handle_position == GTK_POS_TOP ? allocation_height : allocation_height - DRAG_HANDLE_SIZE);
+
+ gtk_style_context_restore (context);
+}
+
+/**
+ * gtk_handle_box_set_shadow_type:
+ * @handle_box: a #GtkHandleBox
+ * @type: the shadow type.
+ *
+ * Sets the type of shadow to be drawn around the border
+ * of the handle box.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ */
+void
+gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box,
+ GtkShadowType type)
+{
+ GtkHandleBoxPrivate *priv;
+
+ g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
+
+ priv = handle_box->priv;
+
+ if ((GtkShadowType) priv->shadow_type != type)
+ {
+ priv->shadow_type = type;
+ g_object_notify (G_OBJECT (handle_box), "shadow-type");
+ gtk_widget_queue_resize (GTK_WIDGET (handle_box));
+ }
+}
+
+/**
+ * gtk_handle_box_get_shadow_type:
+ * @handle_box: a #GtkHandleBox
+ *
+ * Gets the type of shadow drawn around the handle box. See
+ * gtk_handle_box_set_shadow_type().
+ *
+ * Return value: the type of shadow currently drawn around the handle box.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ **/
+GtkShadowType
+gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box)
+{
+ g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), GTK_SHADOW_ETCHED_OUT);
+
+ return handle_box->priv->shadow_type;
+}
+
+/**
+ * gtk_handle_box_set_handle_position:
+ * @handle_box: a #GtkHandleBox
+ * @position: the side of the handlebox where the handle should be drawn.
+ *
+ * Sets the side of the handlebox where the handle is drawn.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ */
+void
+gtk_handle_box_set_handle_position (GtkHandleBox *handle_box,
+ GtkPositionType position)
+{
+ GtkHandleBoxPrivate *priv;
+
+ g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
+
+ priv = handle_box->priv;
+
+ if ((GtkPositionType) priv->handle_position != position)
+ {
+ priv->handle_position = position;
+ g_object_notify (G_OBJECT (handle_box), "handle-position");
+ gtk_widget_queue_resize (GTK_WIDGET (handle_box));
+ }
+}
+
+/**
+ * gtk_handle_box_get_handle_position:
+ * @handle_box: a #GtkHandleBox
+ *
+ * Gets the handle position of the handle box. See
+ * gtk_handle_box_set_handle_position().
+ *
+ * Return value: the current handle position.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ **/
+GtkPositionType
+gtk_handle_box_get_handle_position (GtkHandleBox *handle_box)
+{
+ g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), GTK_POS_LEFT);
+
+ return handle_box->priv->handle_position;
+}
+
+/**
+ * gtk_handle_box_set_snap_edge:
+ * @handle_box: a #GtkHandleBox
+ * @edge: the snap edge, or -1 to unset the value; in which
+ * case GTK+ will try to guess an appropriate value
+ * in the future.
+ *
+ * Sets the snap edge of a handlebox. The snap edge is
+ * the edge of the detached child that must be aligned
+ * with the corresponding edge of the "ghost" left
+ * behind when the child was detached to reattach
+ * the torn-off window. Usually, the snap edge should
+ * be chosen so that it stays in the same place on
+ * the screen when the handlebox is torn off.
+ *
+ * If the snap edge is not set, then an appropriate value
+ * will be guessed from the handle position. If the
+ * handle position is %GTK_POS_RIGHT or %GTK_POS_LEFT,
+ * then the snap edge will be %GTK_POS_TOP, otherwise
+ * it will be %GTK_POS_LEFT.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ */
+void
+gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box,
+ GtkPositionType edge)
+{
+ GtkHandleBoxPrivate *priv;
+
+ g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
+
+ priv = handle_box->priv;
+
+ if (priv->snap_edge != edge)
+ {
+ priv->snap_edge = edge;
+
+ g_object_freeze_notify (G_OBJECT (handle_box));
+ g_object_notify (G_OBJECT (handle_box), "snap-edge");
+ g_object_notify (G_OBJECT (handle_box), "snap-edge-set");
+ g_object_thaw_notify (G_OBJECT (handle_box));
+ }
+}
+
+/**
+ * gtk_handle_box_get_snap_edge:
+ * @handle_box: a #GtkHandleBox
+ *
+ * Gets the edge used for determining reattachment of the handle box.
+ * See gtk_handle_box_set_snap_edge().
+ *
+ * Return value: the edge used for determining reattachment, or
+ * (GtkPositionType)-1 if this is determined (as per default)
+ * from the handle position.
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ **/
+GtkPositionType
+gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box)
+{
+ g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), (GtkPositionType)-1);
+
+ return handle_box->priv->snap_edge;
+}
+
+/**
+ * gtk_handle_box_get_child_detached:
+ * @handle_box: a #GtkHandleBox
+ *
+ * Whether the handlebox's child is currently detached.
+ *
+ * Return value: %TRUE if the child is currently detached, otherwise %FALSE
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 3.4: #GtkHandleBox has been deprecated.
+ **/
+gboolean
+gtk_handle_box_get_child_detached (GtkHandleBox *handle_box)
+{
+ g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), FALSE);
+
+ return handle_box->priv->child_detached;
+}
+
+static void
+gtk_handle_box_paint (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkBin *bin = GTK_BIN (widget);
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkWidget *child;
+ gint width, height;
+ GdkRectangle rect;
+ gint handle_position;
+
+ handle_position = effective_handle_position (hb);
+
+ width = gdk_window_get_width (priv->bin_window);
+ height = gdk_window_get_height (priv->bin_window);
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ gtk_render_background (context, cr, 0, 0, width, height);
+ gtk_render_frame (context, cr, 0, 0, width, height);
+
+ switch (handle_position)
+ {
+ case GTK_POS_LEFT:
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = DRAG_HANDLE_SIZE;
+ rect.height = height;
+ break;
+ case GTK_POS_RIGHT:
+ rect.x = width - DRAG_HANDLE_SIZE;
+ rect.y = 0;
+ rect.width = DRAG_HANDLE_SIZE;
+ rect.height = height;
+ break;
+ case GTK_POS_TOP:
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = width;
+ rect.height = DRAG_HANDLE_SIZE;
+ break;
+ case GTK_POS_BOTTOM:
+ rect.x = 0;
+ rect.y = height - DRAG_HANDLE_SIZE;
+ rect.width = width;
+ rect.height = DRAG_HANDLE_SIZE;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ gtk_render_handle (context, cr,
+ rect.x, rect.y, rect.width, rect.height);
+
+ child = gtk_bin_get_child (bin);
+ if (child != NULL && gtk_widget_get_visible (child))
+ GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->draw (widget, cr);
+
+ gtk_style_context_restore (context);
+}
+
+static gboolean
+gtk_handle_box_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+
+ if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
+ {
+ if (priv->child_detached)
+ gtk_handle_box_draw_ghost (hb, cr);
+ }
+ else if (gtk_cairo_should_draw_window (cr, priv->bin_window))
+ gtk_handle_box_paint (widget, cr);
+
+ return FALSE;
+}
+
+static GtkWidget *
+gtk_handle_box_get_invisible (void)
+{
+ static GtkWidget *handle_box_invisible = NULL;
+
+ if (!handle_box_invisible)
+ {
+ handle_box_invisible = gtk_invisible_new ();
+ gtk_widget_show (handle_box_invisible);
+ }
+
+ return handle_box_invisible;
+}
+
+static gboolean
+gtk_handle_box_grab_event (GtkWidget *widget,
+ GdkEvent *event,
+ GtkHandleBox *hb)
+{
+ GtkHandleBoxPrivate *priv = hb->priv;
+
+ switch (event->type)
+ {
+ case GDK_BUTTON_RELEASE:
+ if (priv->in_drag) /* sanity check */
+ {
+ gtk_handle_box_end_drag (hb, event->button.time);
+ return TRUE;
+ }
+ break;
+
+ case GDK_MOTION_NOTIFY:
+ return gtk_handle_box_motion (GTK_WIDGET (hb), (GdkEventMotion *)event);
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+gtk_handle_box_button_press (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ gboolean event_handled;
+ GdkCursor *fleur;
+ gint handle_position;
+
+ handle_position = effective_handle_position (hb);
+
+ event_handled = FALSE;
+ if ((event->button == 1) &&
+ (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS))
+ {
+ GtkWidget *child;
+ gboolean in_handle;
+
+ if (event->window != priv->bin_window)
+ return FALSE;
+
+ child = gtk_bin_get_child (GTK_BIN (hb));
+
+ if (child)
+ {
+ GtkAllocation child_allocation;
+ guint border_width;
+
+ gtk_widget_get_allocation (child, &child_allocation);
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (hb));
+
+ switch (handle_position)
+ {
+ case GTK_POS_LEFT:
+ in_handle = event->x < DRAG_HANDLE_SIZE;
+ break;
+ case GTK_POS_TOP:
+ in_handle = event->y < DRAG_HANDLE_SIZE;
+ break;
+ case GTK_POS_RIGHT:
+ in_handle = event->x > 2 * border_width + child_allocation.width;
+ break;
+ case GTK_POS_BOTTOM:
+ in_handle = event->y > 2 * border_width + child_allocation.height;
+ break;
+ default:
+ in_handle = FALSE;
+ break;
+ }
+ }
+ else
+ {
+ in_handle = FALSE;
+ event_handled = TRUE;
+ }
+
+ if (in_handle)
+ {
+ if (event->type == GDK_BUTTON_PRESS) /* Start a drag */
+ {
+ GtkWidget *invisible = gtk_handle_box_get_invisible ();
+ GdkWindow *window;
+ gint root_x, root_y;
+
+ gtk_invisible_set_screen (GTK_INVISIBLE (invisible),
+ gtk_widget_get_screen (GTK_WIDGET (hb)));
+ gdk_window_get_origin (priv->bin_window, &root_x, &root_y);
+
+ priv->orig_x = event->x_root;
+ priv->orig_y = event->y_root;
+
+ priv->float_allocation.x = root_x - event->x_root;
+ priv->float_allocation.y = root_y - event->y_root;
+ priv->float_allocation.width = gdk_window_get_width (priv->bin_window);
+ priv->float_allocation.height = gdk_window_get_height (priv->bin_window);
+
+ window = gtk_widget_get_window (widget);
+ if (gdk_window_is_viewable (window))
+ {
+ gdk_window_get_origin (window, &root_x, &root_y);
+
+ priv->attach_allocation.x = root_x;
+ priv->attach_allocation.y = root_y;
+ priv->attach_allocation.width = gdk_window_get_width (window);
+ priv->attach_allocation.height = gdk_window_get_height (window);
+ }
+ else
+ {
+ priv->attach_allocation.x = -1;
+ priv->attach_allocation.y = -1;
+ priv->attach_allocation.width = 0;
+ priv->attach_allocation.height = 0;
+ }
+ priv->in_drag = TRUE;
+ priv->grab_device = event->device;
+ fleur = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
+ GDK_FLEUR);
+ if (gdk_device_grab (event->device,
+ gtk_widget_get_window (invisible),
+ GDK_OWNERSHIP_WINDOW,
+ FALSE,
+ (GDK_BUTTON1_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_BUTTON_RELEASE_MASK),
+ fleur,
+ event->time) != GDK_GRAB_SUCCESS)
+ {
+ priv->in_drag = FALSE;
+ priv->grab_device = NULL;
+ }
+ else
+ {
+ gtk_device_grab_add (invisible, priv->grab_device, TRUE);
+ g_signal_connect (invisible, "event",
+ G_CALLBACK (gtk_handle_box_grab_event), hb);
+ }
+
+ g_object_unref (fleur);
+ event_handled = TRUE;
+ }
+ else if (priv->child_detached) /* Double click */
+ {
+ gtk_handle_box_reattach (hb);
+ }
+ }
+ }
+
+ return event_handled;
+}
+
+static gboolean
+gtk_handle_box_motion (GtkWidget *widget,
+ GdkEventMotion *event)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkWidget *child;
+ gint new_x, new_y;
+ gint snap_edge;
+ gboolean is_snapped = FALSE;
+ gint handle_position;
+ GdkGeometry geometry;
+ GdkScreen *screen, *pointer_screen;
+
+ if (!priv->in_drag)
+ return FALSE;
+ handle_position = effective_handle_position (hb);
+
+ /* Calculate the attachment point on the float, if the float
+ * were detached
+ */
+ new_x = 0;
+ new_y = 0;
+ screen = gtk_widget_get_screen (widget);
+ gdk_device_get_position (event->device,
+ &pointer_screen,
+ &new_x, &new_y);
+ if (pointer_screen != screen)
+ {
+ new_x = priv->orig_x;
+ new_y = priv->orig_y;
+ }
+
+ new_x += priv->float_allocation.x;
+ new_y += priv->float_allocation.y;
+
+ snap_edge = priv->snap_edge;
+ if (snap_edge == -1)
+ snap_edge = (handle_position == GTK_POS_LEFT ||
+ handle_position == GTK_POS_RIGHT) ?
+ GTK_POS_TOP : GTK_POS_LEFT;
+
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ switch (snap_edge)
+ {
+ case GTK_POS_LEFT:
+ snap_edge = GTK_POS_RIGHT;
+ break;
+ case GTK_POS_RIGHT:
+ snap_edge = GTK_POS_LEFT;
+ break;
+ default:
+ break;
+ }
+
+ /* First, check if the snapped edge is aligned
+ */
+ switch (snap_edge)
+ {
+ case GTK_POS_TOP:
+ is_snapped = abs (priv->attach_allocation.y - new_y) < TOLERANCE;
+ break;
+ case GTK_POS_BOTTOM:
+ is_snapped = abs (priv->attach_allocation.y + (gint)priv->attach_allocation.height -
+ new_y - (gint)priv->float_allocation.height) < TOLERANCE;
+ break;
+ case GTK_POS_LEFT:
+ is_snapped = abs (priv->attach_allocation.x - new_x) < TOLERANCE;
+ break;
+ case GTK_POS_RIGHT:
+ is_snapped = abs (priv->attach_allocation.x + (gint)priv->attach_allocation.width -
+ new_x - (gint)priv->float_allocation.width) < TOLERANCE;
+ break;
+ }
+
+ /* Next, check if coordinates in the other direction are sufficiently
+ * aligned
+ */
+ if (is_snapped)
+ {
+ gint float_pos1 = 0; /* Initialize to suppress warnings */
+ gint float_pos2 = 0;
+ gint attach_pos1 = 0;
+ gint attach_pos2 = 0;
+
+ switch (snap_edge)
+ {
+ case GTK_POS_TOP:
+ case GTK_POS_BOTTOM:
+ attach_pos1 = priv->attach_allocation.x;
+ attach_pos2 = priv->attach_allocation.x + priv->attach_allocation.width;
+ float_pos1 = new_x;
+ float_pos2 = new_x + priv->float_allocation.width;
+ break;
+ case GTK_POS_LEFT:
+ case GTK_POS_RIGHT:
+ attach_pos1 = priv->attach_allocation.y;
+ attach_pos2 = priv->attach_allocation.y + priv->attach_allocation.height;
+ float_pos1 = new_y;
+ float_pos2 = new_y + priv->float_allocation.height;
+ break;
+ }
+
+ is_snapped = ((attach_pos1 - TOLERANCE < float_pos1) &&
+ (attach_pos2 + TOLERANCE > float_pos2)) ||
+ ((float_pos1 - TOLERANCE < attach_pos1) &&
+ (float_pos2 + TOLERANCE > attach_pos2));
+ }
+
+ child = gtk_bin_get_child (GTK_BIN (hb));
+
+ if (is_snapped)
+ {
+ if (priv->child_detached)
+ {
+ priv->child_detached = FALSE;
+ gdk_window_hide (priv->float_window);
+ gdk_window_reparent (priv->bin_window, gtk_widget_get_window (widget), 0, 0);
+ priv->float_window_mapped = FALSE;
+ g_signal_emit (hb,
+ handle_box_signals[SIGNAL_CHILD_ATTACHED],
+ 0,
+ child);
+
+ gtk_widget_queue_resize (widget);
+ }
+ }
+ else
+ {
+ gint width, height;
+
+ width = gdk_window_get_width (priv->float_window);
+ height = gdk_window_get_height (priv->float_window);
+
+ switch (handle_position)
+ {
+ case GTK_POS_LEFT:
+ new_y += ((gint)priv->float_allocation.height - height) / 2;
+ break;
+ case GTK_POS_RIGHT:
+ new_x += (gint)priv->float_allocation.width - width;
+ new_y += ((gint)priv->float_allocation.height - height) / 2;
+ break;
+ case GTK_POS_TOP:
+ new_x += ((gint)priv->float_allocation.width - width) / 2;
+ break;
+ case GTK_POS_BOTTOM:
+ new_x += ((gint)priv->float_allocation.width - width) / 2;
+ new_y += (gint)priv->float_allocation.height - height;
+ break;
+ }
+
+ if (priv->child_detached)
+ {
+ gdk_window_move (priv->float_window, new_x, new_y);
+ gdk_window_raise (priv->float_window);
+ }
+ else
+ {
+ guint border_width;
+ GtkRequisition child_requisition;
+
+ priv->child_detached = TRUE;
+
+ if (child)
+ {
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
+ }
+ else
+ {
+ child_requisition.width = 0;
+ child_requisition.height = 0;
+ }
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (hb));
+ width = child_requisition.width + 2 * border_width;
+ height = child_requisition.height + 2 * border_width;
+
+ if (handle_position == GTK_POS_LEFT || handle_position == GTK_POS_RIGHT)
+ width += DRAG_HANDLE_SIZE;
+ else
+ height += DRAG_HANDLE_SIZE;
+
+ gdk_window_move_resize (priv->float_window, new_x, new_y, width, height);
+ gdk_window_reparent (priv->bin_window, priv->float_window, 0, 0);
+ gdk_window_set_geometry_hints (priv->float_window, &geometry, GDK_HINT_POS);
+ gdk_window_show (priv->float_window);
+ priv->float_window_mapped = TRUE;
+#if 0
+ /* this extra move is necessary if we use decorations, or our
+ * window manager insists on decorations.
+ */
+ gdk_display_sync (gtk_widget_get_display (widget));
+ gdk_window_move (priv->float_window, new_x, new_y);
+ gdk_display_sync (gtk_widget_get_display (widget));
+#endif /* 0 */
+ g_signal_emit (hb,
+ handle_box_signals[SIGNAL_CHILD_DETACHED],
+ 0,
+ child);
+
+ gtk_widget_queue_resize (widget);
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+gtk_handle_box_add (GtkContainer *container,
+ GtkWidget *widget)
+{
+ GtkHandleBoxPrivate *priv = GTK_HANDLE_BOX (container)->priv;
+
+ gtk_widget_set_parent_window (widget, priv->bin_window);
+ GTK_CONTAINER_CLASS (gtk_handle_box_parent_class)->add (container, widget);
+}
+
+static void
+gtk_handle_box_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ GTK_CONTAINER_CLASS (gtk_handle_box_parent_class)->remove (container, widget);
+
+ gtk_handle_box_reattach (GTK_HANDLE_BOX (container));
+}
+
+static gint
+gtk_handle_box_delete_event (GtkWidget *widget,
+ GdkEventAny *event)
+{
+ GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
+ GtkHandleBoxPrivate *priv = hb->priv;
+
+ if (event->window == priv->float_window)
+ {
+ gtk_handle_box_reattach (hb);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+gtk_handle_box_reattach (GtkHandleBox *hb)
+{
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkWidget *child;
+ GtkWidget *widget = GTK_WIDGET (hb);
+
+ if (priv->child_detached)
+ {
+ priv->child_detached = FALSE;
+ if (gtk_widget_get_realized (widget))
+ {
+ gdk_window_hide (priv->float_window);
+ gdk_window_reparent (priv->bin_window, gtk_widget_get_window (widget),
+ 0, 0);
+
+ child = gtk_bin_get_child (GTK_BIN (hb));
+ if (child)
+ g_signal_emit (hb,
+ handle_box_signals[SIGNAL_CHILD_ATTACHED],
+ 0,
+ child);
+
+ }
+ priv->float_window_mapped = FALSE;
+ }
+ if (priv->in_drag)
+ gtk_handle_box_end_drag (hb, GDK_CURRENT_TIME);
+
+ gtk_widget_queue_resize (GTK_WIDGET (hb));
+}
+
+static void
+gtk_handle_box_end_drag (GtkHandleBox *hb,
+ guint32 time)
+{
+ GtkHandleBoxPrivate *priv = hb->priv;
+ GtkWidget *invisible = gtk_handle_box_get_invisible ();
+
+ priv->in_drag = FALSE;
+
+ gtk_device_grab_remove (invisible, priv->grab_device);
+ gdk_device_ungrab (priv->grab_device, time);
+ g_signal_handlers_disconnect_by_func (invisible,
+ G_CALLBACK (gtk_handle_box_grab_event),
+ hb);
+
+ priv->grab_device = NULL;
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ * Copyright (C) 1998 Elliot Lee
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/* The GtkHandleBox is to allow widgets to be dragged in and out of
+ * their parents.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HANDLE_BOX_H__
+#define __GTK_HANDLE_BOX_H__
+
+#include <gtk/gtkbin.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HANDLE_BOX (gtk_handle_box_get_type ())
+#define GTK_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBox))
+#define GTK_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass))
+#define GTK_IS_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HANDLE_BOX))
+#define GTK_IS_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HANDLE_BOX))
+#define GTK_HANDLE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass))
+
+typedef struct _GtkHandleBox GtkHandleBox;
+typedef struct _GtkHandleBoxPrivate GtkHandleBoxPrivate;
+typedef struct _GtkHandleBoxClass GtkHandleBoxClass;
+
+struct _GtkHandleBox
+{
+ GtkBin bin;
+
+ /*< private >*/
+ GtkHandleBoxPrivate *priv;
+};
+
+struct _GtkHandleBoxClass
+{
+ GtkBinClass parent_class;
+
+ void (*child_attached) (GtkHandleBox *handle_box,
+ GtkWidget *child);
+ void (*child_detached) (GtkHandleBox *handle_box,
+ GtkWidget *child);
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+
+GType gtk_handle_box_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED
+GtkWidget* gtk_handle_box_new (void);
+GDK_DEPRECATED
+void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box,
+ GtkShadowType type);
+GDK_DEPRECATED
+GtkShadowType gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box);
+GDK_DEPRECATED
+void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box,
+ GtkPositionType position);
+GDK_DEPRECATED
+GtkPositionType gtk_handle_box_get_handle_position(GtkHandleBox *handle_box);
+GDK_DEPRECATED
+void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box,
+ GtkPositionType edge);
+GDK_DEPRECATED
+GtkPositionType gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box);
+GDK_DEPRECATED
+gboolean gtk_handle_box_get_child_detached (GtkHandleBox *handle_box);
+
+G_END_DECLS
+
+#endif /* __GTK_HANDLE_BOX_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkhbbox.h"
+#include "gtkorientable.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtkhbbox
+ * @Short_description: A container for arranging buttons horizontally
+ * @Title: GtkHButtonBox
+ * @See_also: #GtkBox, #GtkButtonBox, #GtkVButtonBox
+ *
+ * A button box should be used to provide a consistent layout of buttons
+ * throughout your application. The layout/spacing can be altered by the
+ * programmer, or if desired, by the user to alter the 'feel' of a
+ * program to a small degree.
+ *
+ * A #GtkHButtonBox is created with gtk_hbutton_box_new(). Buttons are
+ * packed into a button box the same way widgets are added to any other
+ * container, using gtk_container_add(). You can also use
+ * gtk_box_pack_start() or gtk_box_pack_end(), but for button boxes both
+ * these functions work just like gtk_container_add(), ie., they pack the
+ * button in a way that depends on the current layout style and on
+ * whether the button has had gtk_button_box_set_child_secondary() called
+ * on it.
+ *
+ * The spacing between buttons can be set with gtk_box_set_spacing(). The
+ * arrangement and layout of the buttons can be changed with
+ * gtk_button_box_set_layout().
+ *
+ * GtkHButtonBox has been deprecated, use #GtkButtonBox instead.
+ */
+
+
+G_DEFINE_TYPE (GtkHButtonBox, gtk_hbutton_box, GTK_TYPE_BUTTON_BOX)
+
+static void
+gtk_hbutton_box_class_init (GtkHButtonBoxClass *class)
+{
+}
+
+static void
+gtk_hbutton_box_init (GtkHButtonBox *hbutton_box)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hbutton_box),
+ GTK_ORIENTATION_HORIZONTAL);
+}
+
+/**
+ * gtk_hbutton_box_new:
+ *
+ * Creates a new horizontal button box.
+ *
+ * Returns: a new button box #GtkWidget.
+ *
+ * Deprecated: 3.2: Use gtk_button_box_new() with %GTK_ORIENTATION_HORIZONTAL instead
+ */
+GtkWidget *
+gtk_hbutton_box_new (void)
+{
+ return g_object_new (GTK_TYPE_HBUTTON_BOX, NULL);
+}
+
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HBUTTON_BOX_H__
+#define __GTK_HBUTTON_BOX_H__
+
+#include <gtk/gtkbbox.h>
+
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HBUTTON_BOX (gtk_hbutton_box_get_type ())
+#define GTK_HBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HBUTTON_BOX, GtkHButtonBox))
+#define GTK_HBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HBUTTON_BOX, GtkHButtonBoxClass))
+#define GTK_IS_HBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HBUTTON_BOX))
+#define GTK_IS_HBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HBUTTON_BOX))
+#define GTK_HBUTTON_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HBUTTON_BOX, GtkHButtonBoxClass))
+
+
+typedef struct _GtkHButtonBox GtkHButtonBox;
+typedef struct _GtkHButtonBoxClass GtkHButtonBoxClass;
+
+struct _GtkHButtonBox
+{
+ GtkButtonBox button_box;
+};
+
+struct _GtkHButtonBoxClass
+{
+ GtkButtonBoxClass parent_class;
+};
+
+
+GType gtk_hbutton_box_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_button_box_new)
+GtkWidget* gtk_hbutton_box_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_HBUTTON_BOX_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkboxprivate.h"
+#include "gtkorientable.h"
+
+#include "gtkhbox.h"
+
+
+/**
+ * SECTION:gtkhbox
+ * @Short_description: A horizontal container box
+ * @Title: GtkHBox
+ * @See_also: #GtkVBox
+ *
+ * #GtkHBox is a container that organizes child widgets into a single row.
+ *
+ * Use the #GtkBox packing interface to determine the arrangement,
+ * spacing, width, and alignment of #GtkHBox children.
+ *
+ * All children are allocated the same height.
+ *
+ * GtkHBox has been deprecated. You can use #GtkBox instead, which is a
+ * very quick and easy change. If you have derived your own classes from
+ * GtkHBox, you can simply change the inheritance to derive directly
+ * from #GtkBox. No further changes are needed, since the default
+ * value of the #GtkOrientable::orientation property is
+ * %GTK_ORIENTATION_HORIZONTAL.
+ * If you want your code to be future-proof, the recommendation is to
+ * switch to #GtkGrid, since #GtkBox is going to be deprecated in favor
+ * of the more flexible grid widget eventually. For more information
+ * about migrating to #GtkGrid, see <xref linkend="gtk-migrating-GtkGrid"/>
+ */
+
+
+G_DEFINE_TYPE (GtkHBox, gtk_hbox, GTK_TYPE_BOX)
+
+static void
+gtk_hbox_class_init (GtkHBoxClass *class)
+{
+}
+
+static void
+gtk_hbox_init (GtkHBox *hbox)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hbox),
+ GTK_ORIENTATION_HORIZONTAL);
+
+ _gtk_box_set_old_defaults (GTK_BOX (hbox));
+}
+
+/**
+ * gtk_hbox_new:
+ * @homogeneous: %TRUE if all children are to be given equal space allotments.
+ * @spacing: the number of pixels to place by default between children.
+ *
+ * Creates a new #GtkHBox.
+ *
+ * Returns: a new #GtkHBox.
+ *
+ * Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_HORIZONTAL instead,
+ * wich is a very quick and easy change. But the recommendation is to switch to
+ * #GtkGrid, since #GtkBox is going to go away eventually.
+ * See <xref linkend="gtk-migrating-GtkGrid"/>.
+ */
+GtkWidget *
+gtk_hbox_new (gboolean homogeneous,
+ gint spacing)
+{
+ return g_object_new (GTK_TYPE_HBOX,
+ "spacing", spacing,
+ "homogeneous", homogeneous ? TRUE : FALSE,
+ NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HBOX_H__
+#define __GTK_HBOX_H__
+
+
+#include <gtk/gtkbox.h>
+
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HBOX (gtk_hbox_get_type ())
+#define GTK_HBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HBOX, GtkHBox))
+#define GTK_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HBOX, GtkHBoxClass))
+#define GTK_IS_HBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HBOX))
+#define GTK_IS_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HBOX))
+#define GTK_HBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HBOX, GtkHBoxClass))
+
+
+typedef struct _GtkHBox GtkHBox;
+typedef struct _GtkHBoxClass GtkHBoxClass;
+
+struct _GtkHBox
+{
+ GtkBox box;
+};
+
+struct _GtkHBoxClass
+{
+ GtkBoxClass parent_class;
+};
+
+
+GType gtk_hbox_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_box_new)
+GtkWidget * gtk_hbox_new (gboolean homogeneous,
+ gint spacing);
+
+G_END_DECLS
+
+#endif /* __GTK_HBOX_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkhpaned.h"
+#include "gtkorientable.h"
+
+
+/**
+ * SECTION:gtkhpaned
+ * @Short_description: A container with two panes arranged horizontally
+ * @Title: GtkHPaned
+ *
+ * The HPaned widget is a container widget with two
+ * children arranged horizontally. The division between
+ * the two panes is adjustable by the user by dragging
+ * a handle. See #GtkPaned for details.
+ *
+ * GtkHPaned has been deprecated, use #GtkPaned instead.
+ */
+
+
+G_DEFINE_TYPE (GtkHPaned, gtk_hpaned, GTK_TYPE_PANED)
+
+static void
+gtk_hpaned_class_init (GtkHPanedClass *class)
+{
+}
+
+static void
+gtk_hpaned_init (GtkHPaned *hpaned)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hpaned),
+ GTK_ORIENTATION_HORIZONTAL);
+}
+
+/**
+ * gtk_hpaned_new:
+ *
+ * Create a new #GtkHPaned
+ *
+ * Returns: the new #GtkHPaned
+ *
+ * Deprecated: 3.2: Use gtk_paned_new() with %GTK_ORIENTATION_HORIZONTAL instead
+ */
+GtkWidget *
+gtk_hpaned_new (void)
+{
+ return g_object_new (GTK_TYPE_HPANED, NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HPANED_H__
+#define __GTK_HPANED_H__
+
+#include <gtk/gtkpaned.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HPANED (gtk_hpaned_get_type ())
+#define GTK_HPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HPANED, GtkHPaned))
+#define GTK_HPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HPANED, GtkHPanedClass))
+#define GTK_IS_HPANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HPANED))
+#define GTK_IS_HPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HPANED))
+#define GTK_HPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HPANED, GtkHPanedClass))
+
+
+typedef struct _GtkHPaned GtkHPaned;
+typedef struct _GtkHPanedClass GtkHPanedClass;
+
+struct _GtkHPaned
+{
+ GtkPaned paned;
+};
+
+struct _GtkHPanedClass
+{
+ GtkPanedClass parent_class;
+};
+
+
+GType gtk_hpaned_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_paned_new)
+GtkWidget * gtk_hpaned_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_HPANED_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "gtkhscale.h"
+#include "gtkorientable.h"
+
+
+/**
+ * SECTION:gtkhscale
+ * @Short_description: A horizontal slider widget for selecting a value from a range
+ * @Title: GtkHScale
+ *
+ * The #GtkHScale widget is used to allow the user to select a value using
+ * a horizontal slider. To create one, use gtk_hscale_new_with_range().
+ *
+ * The position to show the current value, and the number of decimal places
+ * shown can be set using the parent #GtkScale class's functions.
+ *
+ * GtkHScale has been deprecated, use #GtkScale instead.
+ */
+
+
+G_DEFINE_TYPE (GtkHScale, gtk_hscale, GTK_TYPE_SCALE)
+
+static void
+gtk_hscale_class_init (GtkHScaleClass *class)
+{
+ GtkRangeClass *range_class = GTK_RANGE_CLASS (class);
+
+ range_class->slider_detail = "hscale";
+}
+
+static void
+gtk_hscale_init (GtkHScale *hscale)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hscale),
+ GTK_ORIENTATION_HORIZONTAL);
+}
+
+/**
+ * gtk_hscale_new:
+ * @adjustment: the #GtkAdjustment which sets the range of the scale.
+ *
+ * Creates a new #GtkHScale.
+ *
+ * Returns: a new #GtkHScale.
+ *
+ * Deprecated: 3.2: Use gtk_scale_new() with %GTK_ORIENTATION_HORIZONTAL instead
+ */
+GtkWidget *
+gtk_hscale_new (GtkAdjustment *adjustment)
+{
+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
+ NULL);
+
+ return g_object_new (GTK_TYPE_HSCALE,
+ "adjustment", adjustment,
+ NULL);
+}
+
+/**
+ * gtk_hscale_new_with_range:
+ * @min: minimum value
+ * @max: maximum value
+ * @step: step increment (tick size) used with keyboard shortcuts
+ *
+ * Creates a new horizontal scale widget that lets the user input a
+ * number between @min and @max (including @min and @max) with the
+ * increment @step. @step must be nonzero; it's the distance the
+ * slider moves when using the arrow keys to adjust the scale value.
+ *
+ * Note that the way in which the precision is derived works best if @step
+ * is a power of ten. If the resulting precision is not suitable for your
+ * needs, use gtk_scale_set_digits() to correct it.
+ *
+ * Return value: a new #GtkHScale
+ *
+ * Deprecated: 3.2: Use gtk_scale_new_with_range() with %GTK_ORIENTATION_HORIZONTAL instead
+ **/
+GtkWidget *
+gtk_hscale_new_with_range (gdouble min,
+ gdouble max,
+ gdouble step)
+{
+ GtkAdjustment *adj;
+ GtkScale *scale;
+ gint digits;
+
+ g_return_val_if_fail (min < max, NULL);
+ g_return_val_if_fail (step != 0.0, NULL);
+
+ adj = gtk_adjustment_new (min, min, max, step, 10 * step, 0);
+
+ if (fabs (step) >= 1.0 || step == 0.0)
+ {
+ digits = 0;
+ }
+ else
+ {
+ digits = abs ((gint) floor (log10 (fabs (step))));
+ if (digits > 5)
+ digits = 5;
+ }
+
+ scale = g_object_new (GTK_TYPE_HSCALE,
+ "adjustment", adj,
+ "digits", digits,
+ NULL);
+
+ return GTK_WIDGET (scale);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HSCALE_H__
+#define __GTK_HSCALE_H__
+
+#include <gtk/gtkscale.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HSCALE (gtk_hscale_get_type ())
+#define GTK_HSCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSCALE, GtkHScale))
+#define GTK_HSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSCALE, GtkHScaleClass))
+#define GTK_IS_HSCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSCALE))
+#define GTK_IS_HSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSCALE))
+#define GTK_HSCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSCALE, GtkHScaleClass))
+
+
+typedef struct _GtkHScale GtkHScale;
+typedef struct _GtkHScaleClass GtkHScaleClass;
+
+struct _GtkHScale
+{
+ GtkScale scale;
+};
+
+struct _GtkHScaleClass
+{
+ GtkScaleClass parent_class;
+};
+
+
+GType gtk_hscale_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_scale_new)
+GtkWidget* gtk_hscale_new (GtkAdjustment *adjustment);
+GDK_DEPRECATED_FOR(gtk_scale_new_with_range)
+GtkWidget* gtk_hscale_new_with_range (gdouble min,
+ gdouble max,
+ gdouble step);
+
+G_END_DECLS
+
+#endif /* __GTK_HSCALE_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkscrollbar.h"
+
+#include "gtkhscrollbar.h"
+#include "gtkorientable.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtkhscrollbar
+ * @Short_description: A horizontal scrollbar
+ * @Title: GtkHScrollbar
+ * @See_also: #GtkScrollbar, #GtkScrolledWindow
+ *
+ * The #GtkHScrollbar widget is a widget arranged horizontally creating a
+ * scrollbar. See #GtkScrollbar for details on
+ * scrollbars. #GtkAdjustment pointers may be added to handle the
+ * adjustment of the scrollbar or it may be left %NULL in which case one
+ * will be created for you. See #GtkScrollbar for a description of what the
+ * fields in an adjustment represent for a scrollbar.
+ *
+ * GtkHScrollbar has been deprecated, use #GtkScrollbar instead.
+ */
+
+
+G_DEFINE_TYPE (GtkHScrollbar, gtk_hscrollbar, GTK_TYPE_SCROLLBAR)
+
+static void
+gtk_hscrollbar_class_init (GtkHScrollbarClass *class)
+{
+ GTK_RANGE_CLASS (class)->stepper_detail = "hscrollbar";
+}
+
+static void
+gtk_hscrollbar_init (GtkHScrollbar *hscrollbar)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hscrollbar),
+ GTK_ORIENTATION_HORIZONTAL);
+}
+
+/**
+ * gtk_hscrollbar_new:
+ * @adjustment: (allow-none): the #GtkAdjustment to use, or %NULL to create a new adjustment
+ *
+ * Creates a new horizontal scrollbar.
+ *
+ * Returns: the new #GtkHScrollbar
+ *
+ * Deprecated: 3.2: Use gtk_scrollbar_new() with %GTK_ORIENTATION_HORIZONTAL instead
+ */
+GtkWidget *
+gtk_hscrollbar_new (GtkAdjustment *adjustment)
+{
+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
+ NULL);
+
+ return g_object_new (GTK_TYPE_HSCROLLBAR,
+ "adjustment", adjustment,
+ NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HSCROLLBAR_H__
+#define __GTK_HSCROLLBAR_H__
+
+#include <gtk/gtkscrollbar.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HSCROLLBAR (gtk_hscrollbar_get_type ())
+#define GTK_HSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSCROLLBAR, GtkHScrollbar))
+#define GTK_HSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSCROLLBAR, GtkHScrollbarClass))
+#define GTK_IS_HSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSCROLLBAR))
+#define GTK_IS_HSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSCROLLBAR))
+#define GTK_HSCROLLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSCROLLBAR, GtkHScrollbarClass))
+
+
+typedef struct _GtkHScrollbar GtkHScrollbar;
+typedef struct _GtkHScrollbarClass GtkHScrollbarClass;
+
+struct _GtkHScrollbar
+{
+ GtkScrollbar scrollbar;
+};
+
+struct _GtkHScrollbarClass
+{
+ GtkScrollbarClass parent_class;
+};
+
+
+GType gtk_hscrollbar_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_scrollbar_new)
+GtkWidget* gtk_hscrollbar_new (GtkAdjustment *adjustment);
+
+G_END_DECLS
+
+#endif /* __GTK_HSCROLLBAR_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkhseparator.h"
+#include "gtkorientable.h"
+
+
+/**
+ * SECTION:gtkhseparator
+ * @Short_description: A horizontal separator
+ * @Title: GtkHSeparator
+ * @See_also: #GtkSeparator
+ *
+ * The #GtkHSeparator widget is a horizontal separator, used to group the
+ * widgets within a window. It displays a horizontal line with a shadow to
+ * make it appear sunken into the interface.
+ *
+ * <note>
+ * The #GtkHSeparator widget is not used as a separator within menus.
+ * To create a separator in a menu create an empty #GtkSeparatorMenuItem
+ * widget using gtk_separator_menu_item_new() and add it to the menu with
+ * gtk_menu_shell_append().
+ * </note>
+ *
+ * GtkHSeparator has been deprecated, use #GtkSeparator instead.
+ */
+
+
+G_DEFINE_TYPE (GtkHSeparator, gtk_hseparator, GTK_TYPE_SEPARATOR)
+
+static void
+gtk_hseparator_class_init (GtkHSeparatorClass *class)
+{
+}
+
+static void
+gtk_hseparator_init (GtkHSeparator *hseparator)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hseparator),
+ GTK_ORIENTATION_HORIZONTAL);
+}
+
+/**
+ * gtk_hseparator_new:
+ *
+ * Creates a new #GtkHSeparator.
+ *
+ * Returns: a new #GtkHSeparator.
+ *
+ * Deprecated: 3.2: Use gtk_separator_new() with %GTK_ORIENTATION_HORIZONTAL instead
+ */
+GtkWidget *
+gtk_hseparator_new (void)
+{
+ return g_object_new (GTK_TYPE_HSEPARATOR, NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_HSEPARATOR_H__
+#define __GTK_HSEPARATOR_H__
+
+#include <gtk/gtkseparator.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_HSEPARATOR (gtk_hseparator_get_type ())
+#define GTK_HSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSEPARATOR, GtkHSeparator))
+#define GTK_HSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSEPARATOR, GtkHSeparatorClass))
+#define GTK_IS_HSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSEPARATOR))
+#define GTK_IS_HSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSEPARATOR))
+#define GTK_HSEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSEPARATOR, GtkHSeparatorClass))
+
+
+typedef struct _GtkHSeparator GtkHSeparator;
+typedef struct _GtkHSeparatorClass GtkHSeparatorClass;
+
+struct _GtkHSeparator
+{
+ GtkSeparator separator;
+};
+
+struct _GtkHSeparatorClass
+{
+ GtkSeparatorClass parent_class;
+};
+
+
+GType gtk_hseparator_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_separator_new)
+GtkWidget* gtk_hseparator_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_HSEPARATOR_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
+#include "gtktable.h"
+
+#include "gtktypebuiltins.h"
+#include "gtkprivate.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtktable
+ * @Short_description: Pack widgets in regular patterns
+ * @Title: GtkTable
+ * @See_also: #GtkGrid
+ *
+ * The #GtkTable functions allow the programmer to arrange widgets in rows and
+ * columns, making it easy to align many widgets next to each other,
+ * horizontally and vertically.
+ *
+ * Tables are created with a call to gtk_table_new(), the size of which can
+ * later be changed with gtk_table_resize().
+ *
+ * Widgets can be added to a table using gtk_table_attach() or the more
+ * convenient (but slightly less flexible) gtk_table_attach_defaults().
+ *
+ * To alter the space next to a specific row, use gtk_table_set_row_spacing(),
+ * and for a column, gtk_table_set_col_spacing().
+ * The gaps between <emphasis>all</emphasis> rows or columns can be changed by
+ * calling gtk_table_set_row_spacings() or gtk_table_set_col_spacings()
+ * respectively. Note that spacing is added <emphasis>between</emphasis> the
+ * children, while padding added by gtk_table_attach() is added <emphasis>on
+ * either side</emphasis> of the widget it belongs to.
+ *
+ * gtk_table_set_homogeneous(), can be used to set whether all cells in the
+ * table will resize themselves to the size of the largest widget in the table.
+ *
+ * <note>
+ * #GtkTable has been deprecated. Use #GtkGrid instead. It provides the same
+ * capabilities as GtkTable for arranging widgets in a rectangular grid, but
+ * does support height-for-width geometry management.
+ * </note>
+ */
+
+
+struct _GtkTablePrivate
+{
+ GtkTableRowCol *cols;
+ GtkTableRowCol *rows;
+
+ GList *children;
+
+ guint16 column_spacing;
+ guint16 ncols;
+ guint16 nrows;
+ guint16 row_spacing;
+
+ guint homogeneous : 1;
+};
+
+enum
+{
+ PROP_0,
+ PROP_N_ROWS,
+ PROP_N_COLUMNS,
+ PROP_COLUMN_SPACING,
+ PROP_ROW_SPACING,
+ PROP_HOMOGENEOUS
+};
+
+enum
+{
+ CHILD_PROP_0,
+ CHILD_PROP_LEFT_ATTACH,
+ CHILD_PROP_RIGHT_ATTACH,
+ CHILD_PROP_TOP_ATTACH,
+ CHILD_PROP_BOTTOM_ATTACH,
+ CHILD_PROP_X_OPTIONS,
+ CHILD_PROP_Y_OPTIONS,
+ CHILD_PROP_X_PADDING,
+ CHILD_PROP_Y_PADDING
+};
+
+
+static void gtk_table_finalize (GObject *object);
+static void gtk_table_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_table_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_table_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+static void gtk_table_compute_expand (GtkWidget *widget,
+ gboolean *hexpand,
+ gboolean *vexpand);
+static void gtk_table_add (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_table_remove (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_table_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
+static void gtk_table_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gtk_table_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_table_set_child_property (GtkContainer *container,
+ GtkWidget *child,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_table_get_child_property (GtkContainer *container,
+ GtkWidget *child,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static GType gtk_table_child_type (GtkContainer *container);
+
+
+static void gtk_table_size_request_init (GtkTable *table);
+static void gtk_table_size_request_pass1 (GtkTable *table);
+static void gtk_table_size_request_pass2 (GtkTable *table);
+static void gtk_table_size_request_pass3 (GtkTable *table);
+
+static void gtk_table_size_allocate_init (GtkTable *table);
+static void gtk_table_size_allocate_pass1 (GtkTable *table);
+static void gtk_table_size_allocate_pass2 (GtkTable *table);
+
+
+G_DEFINE_TYPE (GtkTable, gtk_table, GTK_TYPE_CONTAINER)
+
+static void
+gtk_table_class_init (GtkTableClass *class)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
+
+ gobject_class->finalize = gtk_table_finalize;
+
+ gobject_class->get_property = gtk_table_get_property;
+ gobject_class->set_property = gtk_table_set_property;
+
+ widget_class->get_preferred_width = gtk_table_get_preferred_width;
+ widget_class->get_preferred_height = gtk_table_get_preferred_height;
+ widget_class->size_allocate = gtk_table_size_allocate;
+ widget_class->compute_expand = gtk_table_compute_expand;
+
+ container_class->add = gtk_table_add;
+ container_class->remove = gtk_table_remove;
+ container_class->forall = gtk_table_forall;
+ container_class->child_type = gtk_table_child_type;
+ container_class->set_child_property = gtk_table_set_child_property;
+ container_class->get_child_property = gtk_table_get_child_property;
+ gtk_container_class_handle_border_width (container_class);
+
+ g_object_class_install_property (gobject_class,
+ PROP_N_ROWS,
+ g_param_spec_uint ("n-rows",
+ P_("Rows"),
+ P_("The number of rows in the table"),
+ 1,
+ 65535,
+ 1,
+ GTK_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_N_COLUMNS,
+ g_param_spec_uint ("n-columns",
+ P_("Columns"),
+ P_("The number of columns in the table"),
+ 1,
+ 65535,
+ 1,
+ GTK_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_ROW_SPACING,
+ g_param_spec_uint ("row-spacing",
+ P_("Row spacing"),
+ P_("The amount of space between two consecutive rows"),
+ 0,
+ 65535,
+ 0,
+ GTK_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_COLUMN_SPACING,
+ g_param_spec_uint ("column-spacing",
+ P_("Column spacing"),
+ P_("The amount of space between two consecutive columns"),
+ 0,
+ 65535,
+ 0,
+ GTK_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_HOMOGENEOUS,
+ g_param_spec_boolean ("homogeneous",
+ P_("Homogeneous"),
+ P_("If TRUE, the table cells are all the same width/height"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_LEFT_ATTACH,
+ g_param_spec_uint ("left-attach",
+ P_("Left attachment"),
+ P_("The column number to attach the left side of the child to"),
+ 0, 65535, 0,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_RIGHT_ATTACH,
+ g_param_spec_uint ("right-attach",
+ P_("Right attachment"),
+ P_("The column number to attach the right side of a child widget to"),
+ 1, 65535, 1,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_TOP_ATTACH,
+ g_param_spec_uint ("top-attach",
+ P_("Top attachment"),
+ P_("The row number to attach the top of a child widget to"),
+ 0, 65535, 0,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_BOTTOM_ATTACH,
+ g_param_spec_uint ("bottom-attach",
+ P_("Bottom attachment"),
+ P_("The row number to attach the bottom of the child to"),
+ 1, 65535, 1,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_X_OPTIONS,
+ g_param_spec_flags ("x-options",
+ P_("Horizontal options"),
+ P_("Options specifying the horizontal behaviour of the child"),
+ GTK_TYPE_ATTACH_OPTIONS, GTK_EXPAND | GTK_FILL,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_Y_OPTIONS,
+ g_param_spec_flags ("y-options",
+ P_("Vertical options"),
+ P_("Options specifying the vertical behaviour of the child"),
+ GTK_TYPE_ATTACH_OPTIONS, GTK_EXPAND | GTK_FILL,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_X_PADDING,
+ g_param_spec_uint ("x-padding",
+ P_("Horizontal padding"),
+ P_("Extra space to put between the child and its left and right neighbors, in pixels"),
+ 0, 65535, 0,
+ GTK_PARAM_READWRITE));
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_Y_PADDING,
+ g_param_spec_uint ("y-padding",
+ P_("Vertical padding"),
+ P_("Extra space to put between the child and its upper and lower neighbors, in pixels"),
+ 0, 65535, 0,
+ GTK_PARAM_READWRITE));
+
+ g_type_class_add_private (class, sizeof (GtkTablePrivate));
+}
+
+static void
+gtk_table_compute_expand (GtkWidget *widget,
+ gboolean *hexpand_p,
+ gboolean *vexpand_p)
+{
+ GtkTable *table = GTK_TABLE (widget);
+ GtkTablePrivate *priv = table->priv;
+ GList *list;
+ GtkTableChild *child;
+ gboolean hexpand;
+ gboolean vexpand;
+
+ hexpand = FALSE;
+ vexpand = FALSE;
+
+ for (list = priv->children; list; list = list->next)
+ {
+ child = list->data;
+
+ if (!hexpand)
+ hexpand = child->xexpand ||
+ gtk_widget_compute_expand (child->widget,
+ GTK_ORIENTATION_HORIZONTAL);
+
+ if (!vexpand)
+ vexpand = child->yexpand ||
+ gtk_widget_compute_expand (child->widget,
+ GTK_ORIENTATION_VERTICAL);
+
+ if (hexpand && vexpand)
+ break;
+ }
+
+ *hexpand_p = hexpand;
+ *vexpand_p = vexpand;
+}
+
+static GType
+gtk_table_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_WIDGET;
+}
+
+static void
+gtk_table_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkTable *table = GTK_TABLE (object);
+ GtkTablePrivate *priv = table->priv;
+
+ switch (prop_id)
+ {
+ case PROP_N_ROWS:
+ g_value_set_uint (value, priv->nrows);
+ break;
+ case PROP_N_COLUMNS:
+ g_value_set_uint (value, priv->ncols);
+ break;
+ case PROP_ROW_SPACING:
+ g_value_set_uint (value, priv->row_spacing);
+ break;
+ case PROP_COLUMN_SPACING:
+ g_value_set_uint (value, priv->column_spacing);
+ break;
+ case PROP_HOMOGENEOUS:
+ g_value_set_boolean (value, priv->homogeneous);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_table_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkTable *table = GTK_TABLE (object);
+ GtkTablePrivate *priv = table->priv;
+
+ switch (prop_id)
+ {
+ case PROP_N_ROWS:
+ gtk_table_resize (table, g_value_get_uint (value), priv->ncols);
+ break;
+ case PROP_N_COLUMNS:
+ gtk_table_resize (table, priv->nrows, g_value_get_uint (value));
+ break;
+ case PROP_ROW_SPACING:
+ gtk_table_set_row_spacings (table, g_value_get_uint (value));
+ break;
+ case PROP_COLUMN_SPACING:
+ gtk_table_set_col_spacings (table, g_value_get_uint (value));
+ break;
+ case PROP_HOMOGENEOUS:
+ gtk_table_set_homogeneous (table, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_table_set_child_property (GtkContainer *container,
+ GtkWidget *child,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkTable *table = GTK_TABLE (container);
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *table_child;
+ GList *list;
+
+ table_child = NULL;
+ for (list = priv->children; list; list = list->next)
+ {
+ table_child = list->data;
+
+ if (table_child->widget == child)
+ break;
+ }
+ if (!list)
+ {
+ GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
+ return;
+ }
+
+ switch (property_id)
+ {
+ case CHILD_PROP_LEFT_ATTACH:
+ table_child->left_attach = g_value_get_uint (value);
+ if (table_child->right_attach <= table_child->left_attach)
+ table_child->right_attach = table_child->left_attach + 1;
+ if (table_child->right_attach >= priv->ncols)
+ gtk_table_resize (table, priv->nrows, table_child->right_attach);
+ break;
+ case CHILD_PROP_RIGHT_ATTACH:
+ table_child->right_attach = g_value_get_uint (value);
+ if (table_child->right_attach <= table_child->left_attach)
+ table_child->left_attach = table_child->right_attach - 1;
+ if (table_child->right_attach >= priv->ncols)
+ gtk_table_resize (table, priv->nrows, table_child->right_attach);
+ break;
+ case CHILD_PROP_TOP_ATTACH:
+ table_child->top_attach = g_value_get_uint (value);
+ if (table_child->bottom_attach <= table_child->top_attach)
+ table_child->bottom_attach = table_child->top_attach + 1;
+ if (table_child->bottom_attach >= priv->nrows)
+ gtk_table_resize (table, table_child->bottom_attach, priv->ncols);
+ break;
+ case CHILD_PROP_BOTTOM_ATTACH:
+ table_child->bottom_attach = g_value_get_uint (value);
+ if (table_child->bottom_attach <= table_child->top_attach)
+ table_child->top_attach = table_child->bottom_attach - 1;
+ if (table_child->bottom_attach >= priv->nrows)
+ gtk_table_resize (table, table_child->bottom_attach, priv->ncols);
+ break;
+ case CHILD_PROP_X_OPTIONS:
+ {
+ gboolean xexpand;
+
+ xexpand = (g_value_get_flags (value) & GTK_EXPAND) != 0;
+
+ if (table_child->xexpand != xexpand)
+ {
+ table_child->xexpand = xexpand;
+ gtk_widget_queue_compute_expand (GTK_WIDGET (table));
+ }
+
+ table_child->xshrink = (g_value_get_flags (value) & GTK_SHRINK) != 0;
+ table_child->xfill = (g_value_get_flags (value) & GTK_FILL) != 0;
+ }
+ break;
+ case CHILD_PROP_Y_OPTIONS:
+ {
+ gboolean yexpand;
+
+ yexpand = (g_value_get_flags (value) & GTK_EXPAND) != 0;
+
+ if (table_child->yexpand != yexpand)
+ {
+ table_child->yexpand = yexpand;
+ gtk_widget_queue_compute_expand (GTK_WIDGET (table));
+ }
+
+ table_child->yshrink = (g_value_get_flags (value) & GTK_SHRINK) != 0;
+ table_child->yfill = (g_value_get_flags (value) & GTK_FILL) != 0;
+ }
+ break;
+ case CHILD_PROP_X_PADDING:
+ table_child->xpadding = g_value_get_uint (value);
+ break;
+ case CHILD_PROP_Y_PADDING:
+ table_child->ypadding = g_value_get_uint (value);
+ break;
+ default:
+ GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
+ break;
+ }
+ if (gtk_widget_get_visible (child) &&
+ gtk_widget_get_visible (GTK_WIDGET (table)))
+ gtk_widget_queue_resize (child);
+}
+
+static void
+gtk_table_get_child_property (GtkContainer *container,
+ GtkWidget *child,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkTable *table = GTK_TABLE (container);
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *table_child;
+ GList *list;
+
+ table_child = NULL;
+ for (list = priv->children; list; list = list->next)
+ {
+ table_child = list->data;
+
+ if (table_child->widget == child)
+ break;
+ }
+ if (!list)
+ {
+ GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
+ return;
+ }
+
+ switch (property_id)
+ {
+ case CHILD_PROP_LEFT_ATTACH:
+ g_value_set_uint (value, table_child->left_attach);
+ break;
+ case CHILD_PROP_RIGHT_ATTACH:
+ g_value_set_uint (value, table_child->right_attach);
+ break;
+ case CHILD_PROP_TOP_ATTACH:
+ g_value_set_uint (value, table_child->top_attach);
+ break;
+ case CHILD_PROP_BOTTOM_ATTACH:
+ g_value_set_uint (value, table_child->bottom_attach);
+ break;
+ case CHILD_PROP_X_OPTIONS:
+ g_value_set_flags (value, (table_child->xexpand * GTK_EXPAND |
+ table_child->xshrink * GTK_SHRINK |
+ table_child->xfill * GTK_FILL));
+ break;
+ case CHILD_PROP_Y_OPTIONS:
+ g_value_set_flags (value, (table_child->yexpand * GTK_EXPAND |
+ table_child->yshrink * GTK_SHRINK |
+ table_child->yfill * GTK_FILL));
+ break;
+ case CHILD_PROP_X_PADDING:
+ g_value_set_uint (value, table_child->xpadding);
+ break;
+ case CHILD_PROP_Y_PADDING:
+ g_value_set_uint (value, table_child->ypadding);
+ break;
+ default:
+ GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_table_init (GtkTable *table)
+{
+ GtkTablePrivate *priv;
+
+ table->priv = G_TYPE_INSTANCE_GET_PRIVATE (table,
+ GTK_TYPE_TABLE,
+ GtkTablePrivate);
+ priv = table->priv;
+
+ gtk_widget_set_has_window (GTK_WIDGET (table), FALSE);
+ gtk_widget_set_redraw_on_allocate (GTK_WIDGET (table), FALSE);
+
+ priv->children = NULL;
+ priv->rows = NULL;
+ priv->cols = NULL;
+ priv->nrows = 0;
+ priv->ncols = 0;
+ priv->column_spacing = 0;
+ priv->row_spacing = 0;
+ priv->homogeneous = FALSE;
+
+ gtk_table_resize (table, 1, 1);
+}
+
+/**
+ * gtk_table_new:
+ * @rows: The number of rows the new table should have.
+ * @columns: The number of columns the new table should have.
+ * @homogeneous: If set to %TRUE, all table cells are resized to the size of
+ * the cell containing the largest widget.
+ *
+ * Used to create a new table widget. An initial size must be given by
+ * specifying how many rows and columns the table should have, although
+ * this can be changed later with gtk_table_resize(). @rows and @columns
+ * must both be in the range 1 .. 65535. For historical reasons, 0 is accepted
+ * as well and is silently interpreted as 1.
+ *
+ * Returns: A pointer to the the newly created table widget.
+ *
+ * Deprecated: 3.4: Use gtk_grid_new().
+ */
+GtkWidget*
+gtk_table_new (guint rows,
+ guint columns,
+ gboolean homogeneous)
+{
+ GtkTable *table;
+ GtkTablePrivate *priv;
+
+ if (rows == 0)
+ rows = 1;
+ if (columns == 0)
+ columns = 1;
+
+ table = g_object_new (GTK_TYPE_TABLE, NULL);
+ priv = table->priv;
+
+ priv->homogeneous = (homogeneous ? TRUE : FALSE);
+
+ gtk_table_resize (table, rows, columns);
+
+ return GTK_WIDGET (table);
+}
+
+/**
+ * gtk_table_resize:
+ * @table: The #GtkTable you wish to change the size of.
+ * @rows: The new number of rows.
+ * @columns: The new number of columns.
+ *
+ * If you need to change a table's size <emphasis>after</emphasis>
+ * it has been created, this function allows you to do so.
+ *
+ * Deprecated: 3.4: #GtkGrid resizes automatically.
+ */
+void
+gtk_table_resize (GtkTable *table,
+ guint n_rows,
+ guint n_cols)
+{
+ GtkTablePrivate *priv;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+ g_return_if_fail (n_rows > 0 && n_rows <= 65535);
+ g_return_if_fail (n_cols > 0 && n_cols <= 65535);
+
+ priv = table->priv;
+
+ n_rows = MAX (n_rows, 1);
+ n_cols = MAX (n_cols, 1);
+
+ if (n_rows != priv->nrows ||
+ n_cols != priv->ncols)
+ {
+ GList *list;
+
+ for (list = priv->children; list; list = list->next)
+ {
+ GtkTableChild *child;
+
+ child = list->data;
+
+ n_rows = MAX (n_rows, child->bottom_attach);
+ n_cols = MAX (n_cols, child->right_attach);
+ }
+
+ if (n_rows != priv->nrows)
+ {
+ guint i;
+
+ i = priv->nrows;
+ priv->nrows = n_rows;
+ priv->rows = g_realloc (priv->rows, priv->nrows * sizeof (GtkTableRowCol));
+
+ for (; i < priv->nrows; i++)
+ {
+ priv->rows[i].requisition = 0;
+ priv->rows[i].allocation = 0;
+ priv->rows[i].spacing = priv->row_spacing;
+ priv->rows[i].need_expand = 0;
+ priv->rows[i].need_shrink = 0;
+ priv->rows[i].expand = 0;
+ priv->rows[i].shrink = 0;
+ }
+
+ g_object_notify (G_OBJECT (table), "n-rows");
+ }
+
+ if (n_cols != priv->ncols)
+ {
+ guint i;
+
+ i = priv->ncols;
+ priv->ncols = n_cols;
+ priv->cols = g_realloc (priv->cols, priv->ncols * sizeof (GtkTableRowCol));
+
+ for (; i < priv->ncols; i++)
+ {
+ priv->cols[i].requisition = 0;
+ priv->cols[i].allocation = 0;
+ priv->cols[i].spacing = priv->column_spacing;
+ priv->cols[i].need_expand = 0;
+ priv->cols[i].need_shrink = 0;
+ priv->cols[i].expand = 0;
+ priv->cols[i].shrink = 0;
+ }
+
+ g_object_notify (G_OBJECT (table), "n-columns");
+ }
+ }
+}
+
+/**
+ * gtk_table_attach:
+ * @table: The #GtkTable to add a new widget to.
+ * @child: The widget to add.
+ * @left_attach: the column number to attach the left side of a child widget to.
+ * @right_attach: the column number to attach the right side of a child widget to.
+ * @top_attach: the row number to attach the top of a child widget to.
+ * @bottom_attach: the row number to attach the bottom of a child widget to.
+ * @xoptions: Used to specify the properties of the child widget when the table is resized.
+ * @yoptions: The same as xoptions, except this field determines behaviour of vertical resizing.
+ * @xpadding: An integer value specifying the padding on the left and right of the widget being added to the table.
+ * @ypadding: The amount of padding above and below the child widget.
+ *
+ * Adds a widget to a table. The number of 'cells' that a widget will occupy is
+ * specified by @left_attach, @right_attach, @top_attach and @bottom_attach.
+ * These each represent the leftmost, rightmost, uppermost and lowest column
+ * and row numbers of the table. (Columns and rows are indexed from zero).
+ *
+ * To make a button occupy the lower right cell of a 2x2 table, use
+ * <informalexample><programlisting>
+ * gtk_table_attach (table, button,
+ * 1, 2, // left, right attach
+ * 1, 2, // top, bottom attach
+ * xoptions, yoptions,
+ * xpadding, ypadding);
+ * </programlisting></informalexample>
+ * If you want to make the button span the entire bottom row, use @left_attach == 0 and @right_attach = 2 instead.
+ *
+ * Deprecated: 3.4: Use gtk_grid_attach() with #GtkGrid. Note that the attach
+ * arguments differ between those two functions.
+ */
+void
+gtk_table_attach (GtkTable *table,
+ GtkWidget *child,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach,
+ GtkAttachOptions xoptions,
+ GtkAttachOptions yoptions,
+ guint xpadding,
+ guint ypadding)
+{
+ GtkTablePrivate *priv;
+ GtkTableChild *table_child;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (gtk_widget_get_parent (child) == NULL);
+
+ /* g_return_if_fail (left_attach >= 0); */
+ g_return_if_fail (left_attach < right_attach);
+ /* g_return_if_fail (top_attach >= 0); */
+ g_return_if_fail (top_attach < bottom_attach);
+
+ priv = table->priv;
+
+ if (right_attach >= priv->ncols)
+ gtk_table_resize (table, priv->nrows, right_attach);
+
+ if (bottom_attach >= priv->nrows)
+ gtk_table_resize (table, bottom_attach, priv->ncols);
+
+ table_child = g_new (GtkTableChild, 1);
+ table_child->widget = child;
+ table_child->left_attach = left_attach;
+ table_child->right_attach = right_attach;
+ table_child->top_attach = top_attach;
+ table_child->bottom_attach = bottom_attach;
+ table_child->xexpand = (xoptions & GTK_EXPAND) != 0;
+ table_child->xshrink = (xoptions & GTK_SHRINK) != 0;
+ table_child->xfill = (xoptions & GTK_FILL) != 0;
+ table_child->xpadding = xpadding;
+ table_child->yexpand = (yoptions & GTK_EXPAND) != 0;
+ table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
+ table_child->yfill = (yoptions & GTK_FILL) != 0;
+ table_child->ypadding = ypadding;
+
+ priv->children = g_list_prepend (priv->children, table_child);
+
+ gtk_widget_set_parent (child, GTK_WIDGET (table));
+}
+
+/**
+ * gtk_table_attach_defaults:
+ * @table: The table to add a new child widget to.
+ * @widget: The child widget to add.
+ * @left_attach: The column number to attach the left side of the child widget to.
+ * @right_attach: The column number to attach the right side of the child widget to.
+ * @top_attach: The row number to attach the top of the child widget to.
+ * @bottom_attach: The row number to attach the bottom of the child widget to.
+ *
+ * As there are many options associated with gtk_table_attach(), this convenience
+ * function provides the programmer with a means to add children to a table with
+ * identical padding and expansion options. The values used for the #GtkAttachOptions
+ * are <literal>GTK_EXPAND | GTK_FILL</literal>, and the padding is set to 0.
+ *
+ * Deprecated: 3.4: Use gtk_grid_attach() with #GtkGrid. Note that the attach
+ * arguments differ between those two functions.
+ */
+void
+gtk_table_attach_defaults (GtkTable *table,
+ GtkWidget *widget,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach)
+{
+ gtk_table_attach (table, widget,
+ left_attach, right_attach,
+ top_attach, bottom_attach,
+ GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL,
+ 0, 0);
+}
+
+/**
+ * gtk_table_set_row_spacing:
+ * @table: a #GtkTable containing the row whose properties you wish to change.
+ * @row: row number whose spacing will be changed.
+ * @spacing: number of pixels that the spacing should take up.
+ *
+ * Changes the space between a given table row and the subsequent row.
+ *
+ * Deprecated: 3.4: Use gtk_widget_set_margin_top() and
+ * gtk_widget_set_margin_bottom() on the widgets contained in the row if
+ * you need this functionality. #GtkGrid does not support per-row spacing.
+ */
+void
+gtk_table_set_row_spacing (GtkTable *table,
+ guint row,
+ guint spacing)
+{
+ GtkTablePrivate *priv;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+
+ priv = table->priv;
+
+ g_return_if_fail (row < priv->nrows);
+
+ if (priv->rows[row].spacing != spacing)
+ {
+ priv->rows[row].spacing = spacing;
+
+ if (gtk_widget_get_visible (GTK_WIDGET (table)))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
+ }
+}
+
+/**
+ * gtk_table_get_row_spacing:
+ * @table: a #GtkTable
+ * @row: a row in the table, 0 indicates the first row
+ *
+ * Gets the amount of space between row @row, and
+ * row @row + 1. See gtk_table_set_row_spacing().
+ *
+ * Return value: the row spacing
+ *
+ * Deprecated: 3.4: #GtkGrid does not offer a replacement for this
+ * functionality.
+ **/
+guint
+gtk_table_get_row_spacing (GtkTable *table,
+ guint row)
+{
+ GtkTablePrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_TABLE (table), 0);
+
+ priv = table->priv;
+
+ g_return_val_if_fail (row < priv->nrows - 1, 0);
+
+ return priv->rows[row].spacing;
+}
+
+/**
+ * gtk_table_set_col_spacing:
+ * @table: a #GtkTable.
+ * @column: the column whose spacing should be changed.
+ * @spacing: number of pixels that the spacing should take up.
+ *
+ * Alters the amount of space between a given table column and the following
+ * column.
+ *
+ * Deprecated: 3.4: Use gtk_widget_set_margin_left() and
+ * gtk_widget_set_margin_right() on the widgets contained in the row if
+ * you need this functionality. #GtkGrid does not support per-row spacing.
+ */
+void
+gtk_table_set_col_spacing (GtkTable *table,
+ guint column,
+ guint spacing)
+{
+ GtkTablePrivate *priv;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+
+ priv = table->priv;
+
+ g_return_if_fail (column < priv->ncols);
+
+ if (priv->cols[column].spacing != spacing)
+ {
+ priv->cols[column].spacing = spacing;
+
+ if (gtk_widget_get_visible (GTK_WIDGET (table)))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
+ }
+}
+
+/**
+ * gtk_table_get_col_spacing:
+ * @table: a #GtkTable
+ * @column: a column in the table, 0 indicates the first column
+ *
+ * Gets the amount of space between column @col, and
+ * column @col + 1. See gtk_table_set_col_spacing().
+ *
+ * Return value: the column spacing
+ *
+ * Deprecated: 3.4: #GtkGrid does not offer a replacement for this
+ * functionality.
+ **/
+guint
+gtk_table_get_col_spacing (GtkTable *table,
+ guint column)
+{
+ GtkTablePrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_TABLE (table), 0);
+
+ priv = table->priv;
+
+ g_return_val_if_fail (column < priv->ncols, 0);
+
+ return priv->cols[column].spacing;
+}
+
+/**
+ * gtk_table_set_row_spacings:
+ * @table: a #GtkTable.
+ * @spacing: the number of pixels of space to place between every row in the table.
+ *
+ * Sets the space between every row in @table equal to @spacing.
+ *
+ * Deprecated: 3.4: Use gtk_grid_set_row_spacing() with #GtkGrid.
+ */
+void
+gtk_table_set_row_spacings (GtkTable *table,
+ guint spacing)
+{
+ GtkTablePrivate *priv;
+ guint row;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+
+ priv = table->priv;
+
+ priv->row_spacing = spacing;
+ for (row = 0; row < priv->nrows; row++)
+ priv->rows[row].spacing = spacing;
+
+ if (gtk_widget_get_visible (GTK_WIDGET (table)))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
+
+ g_object_notify (G_OBJECT (table), "row-spacing");
+}
+
+/**
+ * gtk_table_get_default_row_spacing:
+ * @table: a #GtkTable
+ *
+ * Gets the default row spacing for the table. This is
+ * the spacing that will be used for newly added rows.
+ * (See gtk_table_set_row_spacings())
+ *
+ * Return value: the default row spacing
+ *
+ * Deprecated: 3.4: Use gtk_grid_get_row_spacing() with #GtkGrid.
+ **/
+guint
+gtk_table_get_default_row_spacing (GtkTable *table)
+{
+ g_return_val_if_fail (GTK_IS_TABLE (table), 0);
+
+ return table->priv->row_spacing;
+}
+
+/**
+ * gtk_table_set_col_spacings:
+ * @table: a #GtkTable.
+ * @spacing: the number of pixels of space to place between every column
+ * in the table.
+ *
+ * Sets the space between every column in @table equal to @spacing.
+ *
+ * Deprecated: 3.4: Use gtk_grid_set_column_spacing() with #GtkGrid.
+ */
+void
+gtk_table_set_col_spacings (GtkTable *table,
+ guint spacing)
+{
+ GtkTablePrivate *priv;
+ guint col;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+
+ priv = table->priv;
+
+ priv->column_spacing = spacing;
+ for (col = 0; col < priv->ncols; col++)
+ priv->cols[col].spacing = spacing;
+
+ if (gtk_widget_get_visible (GTK_WIDGET (table)))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
+
+ g_object_notify (G_OBJECT (table), "column-spacing");
+}
+
+/**
+ * gtk_table_get_default_col_spacing:
+ * @table: a #GtkTable
+ *
+ * Gets the default column spacing for the table. This is
+ * the spacing that will be used for newly added columns.
+ * (See gtk_table_set_col_spacings())
+ *
+ * Return value: the default column spacing
+ *
+ * Deprecated: 3.4: Use gtk_grid_get_column_spacing() with #GtkGrid.
+ **/
+guint
+gtk_table_get_default_col_spacing (GtkTable *table)
+{
+ g_return_val_if_fail (GTK_IS_TABLE (table), 0);
+
+ return table->priv->column_spacing;
+}
+
+/**
+ * gtk_table_set_homogeneous:
+ * @table: The #GtkTable you wish to set the homogeneous properties of.
+ * @homogeneous: Set to %TRUE to ensure all table cells are the same size. Set
+ * to %FALSE if this is not your desired behaviour.
+ *
+ * Changes the homogenous property of table cells, ie. whether all cells are
+ * an equal size or not.
+ *
+ * Deprecated: 3.4: Use gtk_grid_set_row_homogeneous() and
+ * gtk_grid_set_column_homogeneous() with #GtkGrid.
+ */
+void
+gtk_table_set_homogeneous (GtkTable *table,
+ gboolean homogeneous)
+{
+ GtkTablePrivate *priv;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+
+ priv = table->priv;
+
+ homogeneous = (homogeneous != 0);
+ if (homogeneous != priv->homogeneous)
+ {
+ priv->homogeneous = homogeneous;
+
+ if (gtk_widget_get_visible (GTK_WIDGET (table)))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
+
+ g_object_notify (G_OBJECT (table), "homogeneous");
+ }
+}
+
+/**
+ * gtk_table_get_homogeneous:
+ * @table: a #GtkTable
+ *
+ * Returns whether the table cells are all constrained to the same
+ * width and height. (See gtk_table_set_homogenous ())
+ *
+ * Return value: %TRUE if the cells are all constrained to the same size
+ *
+ * Deprecated: 3.4: Use gtk_grid_get_row_homogeneous() and
+ * gtk_grid_get_column_homogeneous() with #GtkGrid.
+ **/
+gboolean
+gtk_table_get_homogeneous (GtkTable *table)
+{
+ g_return_val_if_fail (GTK_IS_TABLE (table), FALSE);
+
+ return table->priv->homogeneous;
+}
+
+/**
+ * gtk_table_get_size:
+ * @table: a #GtkTable
+ * @rows: (out) (allow-none): return location for the number of
+ * rows, or %NULL
+ * @columns: (out) (allow-none): return location for the number
+ * of columns, or %NULL
+ *
+ * Gets the number of rows and columns in the table.
+ *
+ * Since: 2.22
+ *
+ * Deprecated: 3.4: #GtkGrid does not expose the number of columns and
+ * rows.
+ **/
+void
+gtk_table_get_size (GtkTable *table,
+ guint *rows,
+ guint *columns)
+{
+ GtkTablePrivate *priv;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+
+ priv = table->priv;
+
+ if (rows)
+ *rows = priv->nrows;
+
+ if (columns)
+ *columns = priv->ncols;
+}
+
+static void
+gtk_table_finalize (GObject *object)
+{
+ GtkTable *table = GTK_TABLE (object);
+ GtkTablePrivate *priv = table->priv;
+
+ g_free (priv->rows);
+ g_free (priv->cols);
+
+ G_OBJECT_CLASS (gtk_table_parent_class)->finalize (object);
+}
+
+static void
+gtk_table_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkTable *table = GTK_TABLE (widget);
+ GtkTablePrivate *priv = table->priv;
+ gint col;
+
+ gtk_table_size_request_init (table);
+ gtk_table_size_request_pass1 (table);
+ gtk_table_size_request_pass2 (table);
+ gtk_table_size_request_pass3 (table);
+ gtk_table_size_request_pass2 (table);
+
+ *minimum = 0;
+
+ for (col = 0; col < priv->ncols; col++)
+ *minimum += priv->cols[col].requisition;
+ for (col = 0; col + 1 < priv->ncols; col++)
+ *minimum += priv->cols[col].spacing;
+
+ *natural = *minimum;
+}
+
+static void
+gtk_table_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkTable *table = GTK_TABLE (widget);
+ GtkTablePrivate *priv = table->priv;
+ gint row;
+
+ gtk_table_size_request_init (table);
+ gtk_table_size_request_pass1 (table);
+ gtk_table_size_request_pass2 (table);
+ gtk_table_size_request_pass3 (table);
+ gtk_table_size_request_pass2 (table);
+
+ *minimum = 0;
+ for (row = 0; row < priv->nrows; row++)
+ *minimum += priv->rows[row].requisition;
+ for (row = 0; row + 1 < priv->nrows; row++)
+ *minimum += priv->rows[row].spacing;
+
+ *natural = *minimum;
+}
+
+static void
+gtk_table_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkTable *table = GTK_TABLE (widget);
+
+ gtk_widget_set_allocation (widget, allocation);
+
+ gtk_table_size_allocate_init (table);
+ gtk_table_size_allocate_pass1 (table);
+ gtk_table_size_allocate_pass2 (table);
+}
+
+static void
+gtk_table_add (GtkContainer *container,
+ GtkWidget *widget)
+{
+ gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
+}
+
+static void
+gtk_table_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ GtkTable *table = GTK_TABLE (container);
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GtkWidget *widget_container = GTK_WIDGET (container);
+ GList *children;
+
+ children = priv->children;
+
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (child->widget == widget)
+ {
+ gboolean was_visible = gtk_widget_get_visible (widget);
+
+ gtk_widget_unparent (widget);
+
+ priv->children = g_list_remove (priv->children, child);
+ g_free (child);
+
+ if (was_visible && gtk_widget_get_visible (widget_container))
+ gtk_widget_queue_resize (widget_container);
+ break;
+ }
+ }
+}
+
+static void
+gtk_table_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkTable *table = GTK_TABLE (container);
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GList *children;
+
+ children = priv->children;
+
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ (* callback) (child->widget, callback_data);
+ }
+}
+
+static void
+gtk_table_size_request_init (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GList *children;
+ gint row, col;
+
+ for (row = 0; row < priv->nrows; row++)
+ {
+ priv->rows[row].requisition = 0;
+ priv->rows[row].expand = FALSE;
+ }
+ for (col = 0; col < priv->ncols; col++)
+ {
+ priv->cols[col].requisition = 0;
+ priv->cols[col].expand = FALSE;
+ }
+
+ children = priv->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (child->left_attach == (child->right_attach - 1) &&
+ (child->xexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_HORIZONTAL)))
+ priv->cols[child->left_attach].expand = TRUE;
+
+ if (child->top_attach == (child->bottom_attach - 1) &&
+ (child->yexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_VERTICAL)))
+ priv->rows[child->top_attach].expand = TRUE;
+ }
+}
+
+static void
+gtk_table_size_request_pass1 (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GList *children;
+ gint width;
+ gint height;
+
+ children = priv->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (gtk_widget_get_visible (child->widget))
+ {
+ GtkRequisition child_requisition;
+
+ gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
+
+ /* Child spans a single column.
+ */
+ if (child->left_attach == (child->right_attach - 1))
+ {
+ width = child_requisition.width + child->xpadding * 2;
+ priv->cols[child->left_attach].requisition = MAX (priv->cols[child->left_attach].requisition, width);
+ }
+
+ /* Child spans a single row.
+ */
+ if (child->top_attach == (child->bottom_attach - 1))
+ {
+ height = child_requisition.height + child->ypadding * 2;
+ priv->rows[child->top_attach].requisition = MAX (priv->rows[child->top_attach].requisition, height);
+ }
+ }
+ }
+}
+
+static void
+gtk_table_size_request_pass2 (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ gint max_width;
+ gint max_height;
+ gint row, col;
+
+ if (priv->homogeneous)
+ {
+ max_width = 0;
+ max_height = 0;
+
+ for (col = 0; col < priv->ncols; col++)
+ max_width = MAX (max_width, priv->cols[col].requisition);
+ for (row = 0; row < priv->nrows; row++)
+ max_height = MAX (max_height, priv->rows[row].requisition);
+
+ for (col = 0; col < priv->ncols; col++)
+ priv->cols[col].requisition = max_width;
+ for (row = 0; row < priv->nrows; row++)
+ priv->rows[row].requisition = max_height;
+ }
+}
+
+static void
+gtk_table_size_request_pass3 (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GList *children;
+ gint width, height;
+ gint row, col;
+ gint extra;
+
+ children = priv->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (gtk_widget_get_visible (child->widget))
+ {
+ /* Child spans multiple columns.
+ */
+ if (child->left_attach != (child->right_attach - 1))
+ {
+ GtkRequisition child_requisition;
+
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
+
+ /* Check and see if there is already enough space
+ * for the child.
+ */
+ width = 0;
+ for (col = child->left_attach; col < child->right_attach; col++)
+ {
+ width += priv->cols[col].requisition;
+ if ((col + 1) < child->right_attach)
+ width += priv->cols[col].spacing;
+ }
+
+ /* If we need to request more space for this child to fill
+ * its requisition, then divide up the needed space amongst the
+ * columns it spans, favoring expandable columns if any.
+ */
+ if (width < child_requisition.width + child->xpadding * 2)
+ {
+ gint n_expand = 0;
+ gboolean force_expand = FALSE;
+
+ width = child_requisition.width + child->xpadding * 2 - width;
+
+ for (col = child->left_attach; col < child->right_attach; col++)
+ if (priv->cols[col].expand)
+ n_expand++;
+
+ if (n_expand == 0)
+ {
+ n_expand = (child->right_attach - child->left_attach);
+ force_expand = TRUE;
+ }
+
+ for (col = child->left_attach; col < child->right_attach; col++)
+ if (force_expand || priv->cols[col].expand)
+ {
+ extra = width / n_expand;
+ priv->cols[col].requisition += extra;
+ width -= extra;
+ n_expand--;
+ }
+ }
+ }
+
+ /* Child spans multiple rows.
+ */
+ if (child->top_attach != (child->bottom_attach - 1))
+ {
+ GtkRequisition child_requisition;
+
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
+
+ /* Check and see if there is already enough space
+ * for the child.
+ */
+ height = 0;
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ {
+ height += priv->rows[row].requisition;
+ if ((row + 1) < child->bottom_attach)
+ height += priv->rows[row].spacing;
+ }
+
+ /* If we need to request more space for this child to fill
+ * its requisition, then divide up the needed space amongst the
+ * rows it spans, favoring expandable rows if any.
+ */
+ if (height < child_requisition.height + child->ypadding * 2)
+ {
+ gint n_expand = 0;
+ gboolean force_expand = FALSE;
+
+ height = child_requisition.height + child->ypadding * 2 - height;
+
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ {
+ if (priv->rows[row].expand)
+ n_expand++;
+ }
+
+ if (n_expand == 0)
+ {
+ n_expand = (child->bottom_attach - child->top_attach);
+ force_expand = TRUE;
+ }
+
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ if (force_expand || priv->rows[row].expand)
+ {
+ extra = height / n_expand;
+ priv->rows[row].requisition += extra;
+ height -= extra;
+ n_expand--;
+ }
+ }
+ }
+ }
+ }
+}
+
+static void
+gtk_table_size_allocate_init (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GList *children;
+ gint row, col;
+ gint has_expand;
+ gint has_shrink;
+
+ /* Initialize the rows and cols.
+ * By default, rows and cols do not expand and do shrink.
+ * Those values are modified by the children that occupy
+ * the rows and cols.
+ */
+ for (col = 0; col < priv->ncols; col++)
+ {
+ priv->cols[col].allocation = priv->cols[col].requisition;
+ priv->cols[col].need_expand = FALSE;
+ priv->cols[col].need_shrink = TRUE;
+ priv->cols[col].expand = FALSE;
+ priv->cols[col].shrink = TRUE;
+ priv->cols[col].empty = TRUE;
+ }
+ for (row = 0; row < priv->nrows; row++)
+ {
+ priv->rows[row].allocation = priv->rows[row].requisition;
+ priv->rows[row].need_expand = FALSE;
+ priv->rows[row].need_shrink = TRUE;
+ priv->rows[row].expand = FALSE;
+ priv->rows[row].shrink = TRUE;
+ priv->rows[row].empty = TRUE;
+ }
+
+ /* Loop over all the children and adjust the row and col values
+ * based on whether the children want to be allowed to expand
+ * or shrink. This loop handles children that occupy a single
+ * row or column.
+ */
+ children = priv->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (gtk_widget_get_visible (child->widget))
+ {
+ if (child->left_attach == (child->right_attach - 1))
+ {
+ if (child->xexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_HORIZONTAL))
+ priv->cols[child->left_attach].expand = TRUE;
+
+ if (!child->xshrink)
+ priv->cols[child->left_attach].shrink = FALSE;
+
+ priv->cols[child->left_attach].empty = FALSE;
+ }
+
+ if (child->top_attach == (child->bottom_attach - 1))
+ {
+ if (child->yexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_VERTICAL))
+ priv->rows[child->top_attach].expand = TRUE;
+
+ if (!child->yshrink)
+ priv->rows[child->top_attach].shrink = FALSE;
+
+ priv->rows[child->top_attach].empty = FALSE;
+ }
+ }
+ }
+
+ /* Loop over all the children again and this time handle children
+ * which span multiple rows or columns.
+ */
+ children = priv->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (gtk_widget_get_visible (child->widget))
+ {
+ if (child->left_attach != (child->right_attach - 1))
+ {
+ for (col = child->left_attach; col < child->right_attach; col++)
+ priv->cols[col].empty = FALSE;
+
+ if (child->xexpand)
+ {
+ has_expand = FALSE;
+ for (col = child->left_attach; col < child->right_attach; col++)
+ if (priv->cols[col].expand)
+ {
+ has_expand = TRUE;
+ break;
+ }
+
+ if (!has_expand)
+ for (col = child->left_attach; col < child->right_attach; col++)
+ priv->cols[col].need_expand = TRUE;
+ }
+
+ if (!child->xshrink)
+ {
+ has_shrink = TRUE;
+ for (col = child->left_attach; col < child->right_attach; col++)
+ if (!priv->cols[col].shrink)
+ {
+ has_shrink = FALSE;
+ break;
+ }
+
+ if (has_shrink)
+ for (col = child->left_attach; col < child->right_attach; col++)
+ priv->cols[col].need_shrink = FALSE;
+ }
+ }
+
+ if (child->top_attach != (child->bottom_attach - 1))
+ {
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ priv->rows[row].empty = FALSE;
+
+ if (child->yexpand)
+ {
+ has_expand = FALSE;
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ if (priv->rows[row].expand)
+ {
+ has_expand = TRUE;
+ break;
+ }
+
+ if (!has_expand)
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ priv->rows[row].need_expand = TRUE;
+ }
+
+ if (!child->yshrink)
+ {
+ has_shrink = TRUE;
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ if (!priv->rows[row].shrink)
+ {
+ has_shrink = FALSE;
+ break;
+ }
+
+ if (has_shrink)
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ priv->rows[row].need_shrink = FALSE;
+ }
+ }
+ }
+ }
+
+ /* Loop over the columns and set the expand and shrink values
+ * if the column can be expanded or shrunk.
+ */
+ for (col = 0; col < priv->ncols; col++)
+ {
+ if (priv->cols[col].empty)
+ {
+ priv->cols[col].expand = FALSE;
+ priv->cols[col].shrink = FALSE;
+ }
+ else
+ {
+ if (priv->cols[col].need_expand)
+ priv->cols[col].expand = TRUE;
+ if (!priv->cols[col].need_shrink)
+ priv->cols[col].shrink = FALSE;
+ }
+ }
+
+ /* Loop over the rows and set the expand and shrink values
+ * if the row can be expanded or shrunk.
+ */
+ for (row = 0; row < priv->nrows; row++)
+ {
+ if (priv->rows[row].empty)
+ {
+ priv->rows[row].expand = FALSE;
+ priv->rows[row].shrink = FALSE;
+ }
+ else
+ {
+ if (priv->rows[row].need_expand)
+ priv->rows[row].expand = TRUE;
+ if (!priv->rows[row].need_shrink)
+ priv->rows[row].shrink = FALSE;
+ }
+ }
+}
+
+static void
+gtk_table_size_allocate_pass1 (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ GtkAllocation allocation;
+ gint real_width;
+ gint real_height;
+ gint width, height;
+ gint row, col;
+ gint nexpand;
+ gint nshrink;
+ gint extra;
+
+ /* If we were allocated more space than we requested
+ * then we have to expand any expandable rows and columns
+ * to fill in the extra space.
+ */
+ gtk_widget_get_allocation (GTK_WIDGET (table), &allocation);
+ real_width = allocation.width;
+ real_height = allocation.height;
+
+ if (priv->homogeneous)
+ {
+ if (!priv->children)
+ nexpand = 1;
+ else
+ {
+ nexpand = 0;
+ for (col = 0; col < priv->ncols; col++)
+ if (priv->cols[col].expand)
+ {
+ nexpand += 1;
+ break;
+ }
+ }
+ if (nexpand)
+ {
+ width = real_width;
+ for (col = 0; col + 1 < priv->ncols; col++)
+ width -= priv->cols[col].spacing;
+
+ for (col = 0; col < priv->ncols; col++)
+ {
+ extra = width / (priv->ncols - col);
+ priv->cols[col].allocation = MAX (1, extra);
+ width -= extra;
+ }
+ }
+ }
+ else
+ {
+ width = 0;
+ nexpand = 0;
+ nshrink = 0;
+
+ for (col = 0; col < priv->ncols; col++)
+ {
+ width += priv->cols[col].requisition;
+ if (priv->cols[col].expand)
+ nexpand += 1;
+ if (priv->cols[col].shrink)
+ nshrink += 1;
+ }
+ for (col = 0; col + 1 < priv->ncols; col++)
+ width += priv->cols[col].spacing;
+
+ /* Check to see if we were allocated more width than we requested.
+ */
+ if ((width < real_width) && (nexpand >= 1))
+ {
+ width = real_width - width;
+
+ for (col = 0; col < priv->ncols; col++)
+ if (priv->cols[col].expand)
+ {
+ extra = width / nexpand;
+ priv->cols[col].allocation += extra;
+
+ width -= extra;
+ nexpand -= 1;
+ }
+ }
+
+ /* Check to see if we were allocated less width than we requested,
+ * then shrink until we fit the size give.
+ */
+ if (width > real_width)
+ {
+ gint total_nshrink = nshrink;
+
+ extra = width - real_width;
+ while (total_nshrink > 0 && extra > 0)
+ {
+ nshrink = total_nshrink;
+ for (col = 0; col < priv->ncols; col++)
+ if (priv->cols[col].shrink)
+ {
+ gint allocation = priv->cols[col].allocation;
+
+ priv->cols[col].allocation = MAX (1, (gint) priv->cols[col].allocation - extra / nshrink);
+ extra -= allocation - priv->cols[col].allocation;
+ nshrink -= 1;
+ if (priv->cols[col].allocation < 2)
+ {
+ total_nshrink -= 1;
+ priv->cols[col].shrink = FALSE;
+ }
+ }
+ }
+ }
+ }
+
+ if (priv->homogeneous)
+ {
+ if (!priv->children)
+ nexpand = 1;
+ else
+ {
+ nexpand = 0;
+ for (row = 0; row < priv->nrows; row++)
+ if (priv->rows[row].expand)
+ {
+ nexpand += 1;
+ break;
+ }
+ }
+ if (nexpand)
+ {
+ height = real_height;
+
+ for (row = 0; row + 1 < priv->nrows; row++)
+ height -= priv->rows[row].spacing;
+
+ for (row = 0; row < priv->nrows; row++)
+ {
+ extra = height / (priv->nrows - row);
+ priv->rows[row].allocation = MAX (1, extra);
+ height -= extra;
+ }
+ }
+ }
+ else
+ {
+ height = 0;
+ nexpand = 0;
+ nshrink = 0;
+
+ for (row = 0; row < priv->nrows; row++)
+ {
+ height += priv->rows[row].requisition;
+ if (priv->rows[row].expand)
+ nexpand += 1;
+ if (priv->rows[row].shrink)
+ nshrink += 1;
+ }
+ for (row = 0; row + 1 < priv->nrows; row++)
+ height += priv->rows[row].spacing;
+
+ /* Check to see if we were allocated more height than we requested.
+ */
+ if ((height < real_height) && (nexpand >= 1))
+ {
+ height = real_height - height;
+
+ for (row = 0; row < priv->nrows; row++)
+ if (priv->rows[row].expand)
+ {
+ extra = height / nexpand;
+ priv->rows[row].allocation += extra;
+
+ height -= extra;
+ nexpand -= 1;
+ }
+ }
+
+ /* Check to see if we were allocated less height than we requested.
+ * then shrink until we fit the size give.
+ */
+ if (height > real_height)
+ {
+ gint total_nshrink = nshrink;
+
+ extra = height - real_height;
+ while (total_nshrink > 0 && extra > 0)
+ {
+ nshrink = total_nshrink;
+ for (row = 0; row < priv->nrows; row++)
+ if (priv->rows[row].shrink)
+ {
+ gint allocation = priv->rows[row].allocation;
+
+ priv->rows[row].allocation = MAX (1, (gint) priv->rows[row].allocation - extra / nshrink);
+ extra -= allocation - priv->rows[row].allocation;
+ nshrink -= 1;
+ if (priv->rows[row].allocation < 2)
+ {
+ total_nshrink -= 1;
+ priv->rows[row].shrink = FALSE;
+ }
+ }
+ }
+ }
+ }
+}
+
+static void
+gtk_table_size_allocate_pass2 (GtkTable *table)
+{
+ GtkTablePrivate *priv = table->priv;
+ GtkTableChild *child;
+ GList *children;
+ gint max_width;
+ gint max_height;
+ gint x, y;
+ gint row, col;
+ GtkAllocation allocation;
+ GtkAllocation table_allocation, widget_allocation;
+ GtkWidget *widget = GTK_WIDGET (table);
+
+ children = priv->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (gtk_widget_get_visible (child->widget))
+ {
+ GtkRequisition child_requisition;
+
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
+
+ gtk_widget_get_allocation (GTK_WIDGET (table), &table_allocation);
+ x = table_allocation.x;
+ y = table_allocation.y;
+ max_width = 0;
+ max_height = 0;
+
+ for (col = 0; col < child->left_attach; col++)
+ {
+ x += priv->cols[col].allocation;
+ x += priv->cols[col].spacing;
+ }
+
+ for (col = child->left_attach; col < child->right_attach; col++)
+ {
+ max_width += priv->cols[col].allocation;
+ if ((col + 1) < child->right_attach)
+ max_width += priv->cols[col].spacing;
+ }
+
+ for (row = 0; row < child->top_attach; row++)
+ {
+ y += priv->rows[row].allocation;
+ y += priv->rows[row].spacing;
+ }
+
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ {
+ max_height += priv->rows[row].allocation;
+ if ((row + 1) < child->bottom_attach)
+ max_height += priv->rows[row].spacing;
+ }
+
+ if (child->xfill)
+ {
+ allocation.width = MAX (1, max_width - (gint)child->xpadding * 2);
+ allocation.x = x + (max_width - allocation.width) / 2;
+ }
+ else
+ {
+ allocation.width = child_requisition.width;
+ allocation.x = x + (max_width - allocation.width) / 2;
+ }
+
+ if (child->yfill)
+ {
+ allocation.height = MAX (1, max_height - (gint)child->ypadding * 2);
+ allocation.y = y + (max_height - allocation.height) / 2;
+ }
+ else
+ {
+ allocation.height = child_requisition.height;
+ allocation.y = y + (max_height - allocation.height) / 2;
+ }
+
+ gtk_widget_get_allocation (widget, &widget_allocation);
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ allocation.x = widget_allocation.x + widget_allocation.width
+ - (allocation.x - widget_allocation.x) - allocation.width;
+
+ gtk_widget_size_allocate (child->widget, &allocation);
+ }
+ }
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_TABLE_H__
+#define __GTK_TABLE_H__
+
+#include <gtk/gtkcontainer.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_TABLE (gtk_table_get_type ())
+#define GTK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TABLE, GtkTable))
+#define GTK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TABLE, GtkTableClass))
+#define GTK_IS_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TABLE))
+#define GTK_IS_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TABLE))
+#define GTK_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TABLE, GtkTableClass))
+
+
+typedef struct _GtkTable GtkTable;
+typedef struct _GtkTablePrivate GtkTablePrivate;
+typedef struct _GtkTableClass GtkTableClass;
+typedef struct _GtkTableChild GtkTableChild;
+typedef struct _GtkTableRowCol GtkTableRowCol;
+
+struct _GtkTable
+{
+ GtkContainer container;
+
+ /*< private >*/
+ GtkTablePrivate *priv;
+};
+
+struct _GtkTableClass
+{
+ GtkContainerClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+struct _GtkTableChild
+{
+ GtkWidget *widget;
+ guint16 left_attach;
+ guint16 right_attach;
+ guint16 top_attach;
+ guint16 bottom_attach;
+ guint16 xpadding;
+ guint16 ypadding;
+ guint xexpand : 1;
+ guint yexpand : 1;
+ guint xshrink : 1;
+ guint yshrink : 1;
+ guint xfill : 1;
+ guint yfill : 1;
+};
+
+struct _GtkTableRowCol
+{
+ guint16 requisition;
+ guint16 allocation;
+ guint16 spacing;
+ guint need_expand : 1;
+ guint need_shrink : 1;
+ guint expand : 1;
+ guint shrink : 1;
+ guint empty : 1;
+};
+
+
+GType gtk_table_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(GtkGrid)
+GtkWidget* gtk_table_new (guint rows,
+ guint columns,
+ gboolean homogeneous);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_resize (GtkTable *table,
+ guint rows,
+ guint columns);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_attach (GtkTable *table,
+ GtkWidget *child,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach,
+ GtkAttachOptions xoptions,
+ GtkAttachOptions yoptions,
+ guint xpadding,
+ guint ypadding);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_attach_defaults (GtkTable *table,
+ GtkWidget *widget,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_set_row_spacing (GtkTable *table,
+ guint row,
+ guint spacing);
+GDK_DEPRECATED_FOR(GtkGrid)
+guint gtk_table_get_row_spacing (GtkTable *table,
+ guint row);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_set_col_spacing (GtkTable *table,
+ guint column,
+ guint spacing);
+GDK_DEPRECATED_FOR(GtkGrid)
+guint gtk_table_get_col_spacing (GtkTable *table,
+ guint column);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_set_row_spacings (GtkTable *table,
+ guint spacing);
+GDK_DEPRECATED_FOR(GtkGrid)
+guint gtk_table_get_default_row_spacing (GtkTable *table);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_set_col_spacings (GtkTable *table,
+ guint spacing);
+GDK_DEPRECATED_FOR(GtkGrid)
+guint gtk_table_get_default_col_spacing (GtkTable *table);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_set_homogeneous (GtkTable *table,
+ gboolean homogeneous);
+GDK_DEPRECATED_FOR(GtkGrid)
+gboolean gtk_table_get_homogeneous (GtkTable *table);
+GDK_DEPRECATED_FOR(GtkGrid)
+void gtk_table_get_size (GtkTable *table,
+ guint *rows,
+ guint *columns);
+
+G_END_DECLS
+
+#endif /* __GTK_TABLE_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkmenuprivate.h"
+#include "gtkmenuitemprivate.h"
+#include "gtktearoffmenuitem.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtktearoffmenuitem
+ * @Short_description: A menu item used to tear off and reattach its menu
+ * @Title: GtkTearoffMenuItem
+ * @See_also: #GtkMenu
+ *
+ * A #GtkTearoffMenuItem is a special #GtkMenuItem which is used to
+ * tear off and reattach its menu.
+ *
+ * When its menu is shown normally, the #GtkTearoffMenuItem is drawn as a
+ * dotted line indicating that the menu can be torn off. Activating it
+ * causes its menu to be torn off and displayed in its own window
+ * as a tearoff menu.
+ *
+ * When its menu is shown as a tearoff menu, the #GtkTearoffMenuItem is drawn
+ * as a dotted line which has a left pointing arrow graphic indicating that
+ * the tearoff menu can be reattached. Activating it will erase the tearoff
+ * menu window.
+ *
+ * <note>#GtkTearoffMenuItem is deprecated and should not be used in newly
+ * written code. Menus are not meant to be torn around.</note>
+ */
+
+
+#define ARROW_SIZE 10
+#define TEAR_LENGTH 5
+#define BORDER_SPACING 3
+
+struct _GtkTearoffMenuItemPrivate
+{
+ guint torn_off : 1;
+};
+
+static void gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static gboolean gtk_tearoff_menu_item_draw (GtkWidget *widget,
+ cairo_t *cr);
+static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item);
+static void gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
+ GtkWidget *previous);
+
+G_DEFINE_TYPE (GtkTearoffMenuItem, gtk_tearoff_menu_item, GTK_TYPE_MENU_ITEM)
+
+/**
+ * gtk_tearoff_menu_item_new:
+ *
+ * Creates a new #GtkTearoffMenuItem.
+ *
+ * Returns: a new #GtkTearoffMenuItem.
+ *
+ * Deprecated: 3.4: #GtkTearoffMenuItem is deprecated and should not be
+ * used in newly written code.
+ */
+GtkWidget*
+gtk_tearoff_menu_item_new (void)
+{
+ return g_object_new (GTK_TYPE_TEAROFF_MENU_ITEM, NULL);
+}
+
+static void
+gtk_tearoff_menu_item_class_init (GtkTearoffMenuItemClass *klass)
+{
+ GtkWidgetClass *widget_class;
+ GtkMenuItemClass *menu_item_class;
+
+ widget_class = (GtkWidgetClass*) klass;
+ menu_item_class = (GtkMenuItemClass*) klass;
+
+ widget_class->draw = gtk_tearoff_menu_item_draw;
+ widget_class->get_preferred_width = gtk_tearoff_menu_item_get_preferred_width;
+ widget_class->get_preferred_height = gtk_tearoff_menu_item_get_preferred_height;
+ widget_class->parent_set = gtk_tearoff_menu_item_parent_set;
+
+ gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_TEAR_OFF_MENU_ITEM);
+
+ menu_item_class->activate = gtk_tearoff_menu_item_activate;
+
+ g_type_class_add_private (klass, sizeof (GtkTearoffMenuItemPrivate));
+}
+
+static void
+gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item)
+{
+ GtkTearoffMenuItemPrivate *priv;
+
+ tearoff_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (tearoff_menu_item,
+ GTK_TYPE_TEAROFF_MENU_ITEM,
+ GtkTearoffMenuItemPrivate);
+ priv = tearoff_menu_item->priv;
+
+ priv->torn_off = FALSE;
+}
+
+static void
+gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkStyleContext *context;
+ guint border_width;
+ GtkBorder padding;
+ GtkStateFlags state;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_get_padding (context, state, &padding);
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ *minimum = *natural = (border_width + BORDER_SPACING) * 2 + padding.left + padding.right;
+}
+
+static void
+gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkStyleContext *context;
+ GtkBorder padding;
+ GtkStateFlags state;
+ GtkWidget *parent;
+ guint border_width;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_get_padding (context, state, &padding);
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ *minimum = *natural = (border_width * 2) + padding.top + padding.bottom;
+
+ parent = gtk_widget_get_parent (widget);
+ if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
+ {
+ *minimum += ARROW_SIZE;
+ *natural += ARROW_SIZE;
+ }
+ else
+ {
+ *minimum += padding.top + 4;
+ *natural += padding.top + 4;
+ }
+}
+
+static gboolean
+gtk_tearoff_menu_item_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GtkMenuItem *menu_item;
+ GtkStateFlags state;
+ GtkStyleContext *context;
+ GtkBorder padding;
+ gint x, y, width, height;
+ gint right_max;
+ guint border_width;
+ GtkTextDirection direction;
+ GtkWidget *parent;
+ gdouble angle;
+
+ menu_item = GTK_MENU_ITEM (widget);
+ context = gtk_widget_get_style_context (widget);
+ direction = gtk_widget_get_direction (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_item));
+ x = border_width;
+ y = border_width;
+ width = gtk_widget_get_allocated_width (widget) - border_width * 2;
+ height = gtk_widget_get_allocated_height (widget) - border_width * 2;
+ right_max = x + width;
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+ gtk_style_context_get_padding (context, state, &padding);
+
+ if (state & GTK_STATE_FLAG_PRELIGHT)
+ {
+ gtk_render_background (context, cr, x, y, width, height);
+ gtk_render_frame (context, cr, x, y, width, height);
+ }
+
+ parent = gtk_widget_get_parent (widget);
+ if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
+ {
+ gint arrow_x;
+
+ if (menu_item->priv->toggle_size > ARROW_SIZE)
+ {
+ if (direction == GTK_TEXT_DIR_LTR)
+ {
+ arrow_x = x + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
+ angle = (3 * G_PI) / 2;
+ }
+ else
+ {
+ arrow_x = x + width - menu_item->priv->toggle_size + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
+ angle = G_PI / 2;
+ }
+ x += menu_item->priv->toggle_size + BORDER_SPACING;
+ }
+ else
+ {
+ if (direction == GTK_TEXT_DIR_LTR)
+ {
+ arrow_x = ARROW_SIZE / 2;
+ angle = (3 * G_PI) / 2;
+ }
+ else
+ {
+ arrow_x = x + width - 2 * ARROW_SIZE + ARROW_SIZE / 2;
+ angle = G_PI / 2;
+ }
+ x += 2 * ARROW_SIZE;
+ }
+
+ gtk_render_arrow (context, cr, angle,
+ arrow_x, height / 2 - 5,
+ ARROW_SIZE);
+ }
+
+ while (x < right_max)
+ {
+ gint x1, x2;
+
+ if (direction == GTK_TEXT_DIR_LTR)
+ {
+ x1 = x;
+ x2 = MIN (x + TEAR_LENGTH, right_max);
+ }
+ else
+ {
+ x1 = right_max - x;
+ x2 = MAX (right_max - x - TEAR_LENGTH, 0);
+ }
+
+ gtk_render_line (context, cr,
+ x1, y + (height - padding.bottom) / 2,
+ x2, y + (height - padding.bottom) / 2);
+ x += 2 * TEAR_LENGTH;
+ }
+
+ gtk_style_context_restore (context);
+
+ return FALSE;
+}
+
+static void
+gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item)
+{
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (GTK_WIDGET (menu_item));
+ if (GTK_IS_MENU (parent))
+ {
+ GtkMenu *menu = GTK_MENU (parent);
+
+ gtk_widget_queue_resize (GTK_WIDGET (menu_item));
+ gtk_menu_set_tearoff_state (GTK_MENU (parent),
+ !menu->priv->torn_off);
+ }
+}
+
+static void
+tearoff_state_changed (GtkMenu *menu,
+ GParamSpec *pspec,
+ gpointer data)
+{
+ GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (data);
+ GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
+
+ priv->torn_off = gtk_menu_get_tearoff_state (menu);
+}
+
+static void
+gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
+ GtkWidget *previous)
+{
+ GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (widget);
+ GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
+ GtkMenu *menu;
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (widget);
+ menu = GTK_IS_MENU (parent) ? GTK_MENU (parent) : NULL;
+
+ if (previous)
+ g_signal_handlers_disconnect_by_func (previous,
+ tearoff_state_changed,
+ tearoff_menu_item);
+
+ if (menu)
+ {
+ priv->torn_off = gtk_menu_get_tearoff_state (menu);
+ g_signal_connect (menu, "notify::tearoff-state",
+ G_CALLBACK (tearoff_state_changed),
+ tearoff_menu_item);
+ }
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_TEAROFF_MENU_ITEM_H__
+#define __GTK_TEAROFF_MENU_ITEM_H__
+
+#include <gtk/gtkmenuitem.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_TEAROFF_MENU_ITEM (gtk_tearoff_menu_item_get_type ())
+#define GTK_TEAROFF_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItem))
+#define GTK_TEAROFF_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass))
+#define GTK_IS_TEAROFF_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEAROFF_MENU_ITEM))
+#define GTK_IS_TEAROFF_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEAROFF_MENU_ITEM))
+#define GTK_TEAROFF_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass))
+
+
+typedef struct _GtkTearoffMenuItem GtkTearoffMenuItem;
+typedef struct _GtkTearoffMenuItemPrivate GtkTearoffMenuItemPrivate;
+typedef struct _GtkTearoffMenuItemClass GtkTearoffMenuItemClass;
+
+struct _GtkTearoffMenuItem
+{
+ GtkMenuItem menu_item;
+
+ /*< private >*/
+ GtkTearoffMenuItemPrivate *priv;
+};
+
+struct _GtkTearoffMenuItemClass
+{
+ GtkMenuItemClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+
+GType gtk_tearoff_menu_item_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_tearoff_menu_item_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_TEAROFF_MENU_ITEM_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkvbbox.h"
+#include "gtkorientable.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtkvbbox
+ * @Short_description: A container for arranging buttons vertically
+ * @Title: GtkVButtonBox
+ * @See_also: #GtkBox, #GtkButtonBox, #GtkHButtonBox
+ *
+ * A button box should be used to provide a consistent layout of buttons
+ * throughout your application. The layout/spacing can be altered by the
+ * programmer, or if desired, by the user to alter the 'feel' of a
+ * program to a small degree.
+ *
+ * A #GtkVButtonBox is created with gtk_vbutton_box_new(). Buttons are
+ * packed into a button box the same way widgets are added to any other
+ * container, using gtk_container_add(). You can also use
+ * gtk_box_pack_start() or gtk_box_pack_end(), but for button boxes both
+ * these functions work just like gtk_container_add(), ie., they pack the
+ * button in a way that depends on the current layout style and on
+ * whether the button has had gtk_button_box_set_child_secondary() called
+ * on it.
+ *
+ * The spacing between buttons can be set with gtk_box_set_spacing(). The
+ * arrangement and layout of the buttons can be changed with
+ * gtk_button_box_set_layout().
+ *
+ * GtkVButtonBox has been deprecated, use #GtkButtonBox instead.
+ */
+
+G_DEFINE_TYPE (GtkVButtonBox, gtk_vbutton_box, GTK_TYPE_BUTTON_BOX)
+
+static void
+gtk_vbutton_box_class_init (GtkVButtonBoxClass *class)
+{
+}
+
+static void
+gtk_vbutton_box_init (GtkVButtonBox *vbutton_box)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vbutton_box),
+ GTK_ORIENTATION_VERTICAL);
+}
+
+/**
+ * gtk_vbutton_box_new:
+ *
+ * Creates a new vertical button box.
+ *
+ * Returns: a new button box #GtkWidget.
+ *
+ * Deprecated: 3.2: Use gtk_button_box_new() with %GTK_ORIENTATION_VERTICAL instead
+ */
+GtkWidget *
+gtk_vbutton_box_new (void)
+{
+ return g_object_new (GTK_TYPE_VBUTTON_BOX, NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_VBBOX_H__
+#define __GTK_VBBOX_H__
+
+#include <gtk/gtkbbox.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_VBUTTON_BOX (gtk_vbutton_box_get_type ())
+#define GTK_VBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VBUTTON_BOX, GtkVButtonBox))
+#define GTK_VBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VBUTTON_BOX, GtkVButtonBoxClass))
+#define GTK_IS_VBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VBUTTON_BOX))
+#define GTK_IS_VBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VBUTTON_BOX))
+#define GTK_VBUTTON_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VBUTTON_BOX, GtkVButtonBoxClass))
+
+
+typedef struct _GtkVButtonBox GtkVButtonBox;
+typedef struct _GtkVButtonBoxClass GtkVButtonBoxClass;
+
+struct _GtkVButtonBox
+{
+ GtkButtonBox button_box;
+};
+
+struct _GtkVButtonBoxClass
+{
+ GtkButtonBoxClass parent_class;
+};
+
+
+GType gtk_vbutton_box_get_type (void) G_GNUC_CONST;
+GtkWidget *gtk_vbutton_box_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_VBBOX_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkboxprivate.h"
+#include "gtkorientable.h"
+
+#include "gtkvbox.h"
+#include "gtkboxprivate.h"
+
+
+/**
+ * SECTION:gtkvbox
+ * @Short_description: A vertical container box
+ * @Title: GtkVBox
+ * @See_also: #GtkHBox
+ *
+ * A #GtkVBox is a container that organizes child widgets into a single column.
+ *
+ * Use the #GtkBox packing interface to determine the arrangement,
+ * spacing, height, and alignment of #GtkVBox children.
+ *
+ * All children are allocated the same width.
+ *
+ * GtkVBox has been deprecated. You can use #GtkBox instead, which is a
+ * very quick and easy change. If you have derived your own classes from
+ * GtkVBox, you can simply change the inheritance to derive directly
+ * from #GtkBox, and set the #GtkOrientable::orientation property to
+ * %GTK_ORIENTATION_VERTICAL in your instance init function, with a
+ * call like:
+ * |[
+ * gtk_orientable_set_orientation (GTK_ORIENTABLE (object),
+ * GTK_ORIENTATION_VERTICAL);
+ * ]|
+ * If you want your code to be future-proof, the recommendation is to
+ * switch to #GtkGrid, since #GtkBox is going to be deprecated in favor
+ * of the more flexible grid widget eventually. For more information
+ * about migrating to #GtkGrid, see <xref linkend="gtk-migrating-GtkGrid"/>.
+ */
+
+G_DEFINE_TYPE (GtkVBox, gtk_vbox, GTK_TYPE_BOX)
+
+static void
+gtk_vbox_class_init (GtkVBoxClass *class)
+{
+}
+
+static void
+gtk_vbox_init (GtkVBox *vbox)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vbox),
+ GTK_ORIENTATION_VERTICAL);
+
+ _gtk_box_set_old_defaults (GTK_BOX (vbox));
+}
+
+/**
+ * gtk_vbox_new:
+ * @homogeneous: %TRUE if all children are to be given equal space allotments.
+ * @spacing: the number of pixels to place by default between children.
+ *
+ * Creates a new #GtkVBox.
+ *
+ * Returns: a new #GtkVBox.
+ *
+ * Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_VERTICAL instead,
+ * wich is a very quick and easy change. But the recommendation is to switch to
+ * #GtkGrid, since #GtkBox is going to go away eventually.
+ * See <xref linkend="gtk-migrating-GtkGrid"/>.
+ */
+GtkWidget *
+gtk_vbox_new (gboolean homogeneous,
+ gint spacing)
+{
+ return g_object_new (GTK_TYPE_VBOX,
+ "spacing", spacing,
+ "homogeneous", homogeneous ? TRUE : FALSE,
+ NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_VBOX_H__
+#define __GTK_VBOX_H__
+
+#include <gtk/gtkbox.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_VBOX (gtk_vbox_get_type ())
+#define GTK_VBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VBOX, GtkVBox))
+#define GTK_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VBOX, GtkVBoxClass))
+#define GTK_IS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VBOX))
+#define GTK_IS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VBOX))
+#define GTK_VBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VBOX, GtkVBoxClass))
+
+
+typedef struct _GtkVBox GtkVBox;
+typedef struct _GtkVBoxClass GtkVBoxClass;
+
+struct _GtkVBox
+{
+ GtkBox box;
+};
+
+struct _GtkVBoxClass
+{
+ GtkBoxClass parent_class;
+};
+
+
+GType gtk_vbox_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_FOR(gtk_box_new)
+GtkWidget * gtk_vbox_new (gboolean homogeneous,
+ gint spacing);
+
+G_END_DECLS
+
+#endif /* __GTK_VBOX_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkorientable.h"
+
+#include "gtkvpaned.h"
+
+
+/**
+ * SECTION:gtkvpaned
+ * @Short_description: A container with two panes arranged vertically
+ * @Title: GtkVPaned
+ *
+ * The VPaned widget is a container widget with two
+ * children arranged vertically. The division between
+ * the two panes is adjustable by the user by dragging
+ * a handle. See #GtkPaned for details.
+ *
+ * GtkVPaned has been deprecated, use #GtkPaned instead.
+ */
+
+G_DEFINE_TYPE (GtkVPaned, gtk_vpaned, GTK_TYPE_PANED)
+
+static void
+gtk_vpaned_class_init (GtkVPanedClass *class)
+{
+}
+
+static void
+gtk_vpaned_init (GtkVPaned *vpaned)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vpaned),
+ GTK_ORIENTATION_VERTICAL);
+}
+
+/**
+ * gtk_vpaned_new:
+ *
+ * Create a new #GtkVPaned
+ *
+ * Returns: the new #GtkVPaned
+ *
+ * Deprecated: 3.2: Use gtk_paned_new() with %GTK_ORIENTATION_VERTICAL instead
+ */
+GtkWidget *
+gtk_vpaned_new (void)
+{
+ return g_object_new (GTK_TYPE_VPANED, NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_VPANED_H__
+#define __GTK_VPANED_H__
+
+#include <gtk/gtkpaned.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_VPANED (gtk_vpaned_get_type ())
+#define GTK_VPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VPANED, GtkVPaned))
+#define GTK_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VPANED, GtkVPanedClass))
+#define GTK_IS_VPANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VPANED))
+#define GTK_IS_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VPANED))
+#define GTK_VPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VPANED, GtkVPanedClass))
+
+
+typedef struct _GtkVPaned GtkVPaned;
+typedef struct _GtkVPanedClass GtkVPanedClass;
+
+struct _GtkVPaned
+{
+ GtkPaned paned;
+};
+
+struct _GtkVPanedClass
+{
+ GtkPanedClass parent_class;
+};
+
+
+GType gtk_vpaned_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_vpaned_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_VPANED_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "gtkvscale.h"
+#include "gtkorientable.h"
+
+
+/**
+ * SECTION:gtkvscale
+ * @Short_description: A vertical slider widget for selecting a value from a range
+ * @Title: GtkVScale
+ *
+ * The #GtkVScale widget is used to allow the user to select a value using
+ * a vertical slider. To create one, use gtk_hscale_new_with_range().
+ *
+ * The position to show the current value, and the number of decimal places
+ * shown can be set using the parent #GtkScale class's functions.
+ *
+ * GtkVScale has been deprecated, use #GtkScale instead.
+ */
+
+G_DEFINE_TYPE (GtkVScale, gtk_vscale, GTK_TYPE_SCALE)
+
+static void
+gtk_vscale_class_init (GtkVScaleClass *class)
+{
+ GtkRangeClass *range_class = GTK_RANGE_CLASS (class);
+
+ range_class->slider_detail = "vscale";
+}
+
+static void
+gtk_vscale_init (GtkVScale *vscale)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vscale),
+ GTK_ORIENTATION_VERTICAL);
+}
+/**
+ * gtk_vscale_new:
+ * @adjustment: the #GtkAdjustment which sets the range of the scale.
+ *
+ * Creates a new #GtkVScale.
+ *
+ * Returns: a new #GtkVScale.
+ *
+ * Deprecated: 3.2: Use gtk_scale_new() with %GTK_ORIENTATION_VERTICAL instead
+ */
+GtkWidget *
+gtk_vscale_new (GtkAdjustment *adjustment)
+{
+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
+ NULL);
+
+ return g_object_new (GTK_TYPE_VSCALE,
+ "adjustment", adjustment,
+ NULL);
+}
+
+/**
+ * gtk_vscale_new_with_range:
+ * @min: minimum value
+ * @max: maximum value
+ * @step: step increment (tick size) used with keyboard shortcuts
+ *
+ * Creates a new vertical scale widget that lets the user input a
+ * number between @min and @max (including @min and @max) with the
+ * increment @step. @step must be nonzero; it's the distance the
+ * slider moves when using the arrow keys to adjust the scale value.
+ *
+ * Note that the way in which the precision is derived works best if @step
+ * is a power of ten. If the resulting precision is not suitable for your
+ * needs, use gtk_scale_set_digits() to correct it.
+ *
+ * Return value: a new #GtkVScale
+ *
+ * Deprecated: 3.2: Use gtk_scale_new_with_range() with %GTK_ORIENTATION_VERTICAL instead
+ **/
+GtkWidget *
+gtk_vscale_new_with_range (gdouble min,
+ gdouble max,
+ gdouble step)
+{
+ GtkAdjustment *adj;
+ GtkScale *scale;
+ gint digits;
+
+ g_return_val_if_fail (min < max, NULL);
+ g_return_val_if_fail (step != 0.0, NULL);
+
+ adj = gtk_adjustment_new (min, min, max, step, 10 * step, 0);
+
+ if (fabs (step) >= 1.0 || step == 0.0)
+ {
+ digits = 0;
+ }
+ else
+ {
+ digits = abs ((gint) floor (log10 (fabs (step))));
+ if (digits > 5)
+ digits = 5;
+ }
+
+ scale = g_object_new (GTK_TYPE_VSCALE,
+ "adjustment", adj,
+ "digits", digits,
+ NULL);
+
+ return GTK_WIDGET (scale);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_VSCALE_H__
+#define __GTK_VSCALE_H__
+
+#include <gtk/gtkscale.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_VSCALE (gtk_vscale_get_type ())
+#define GTK_VSCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VSCALE, GtkVScale))
+#define GTK_VSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSCALE, GtkVScaleClass))
+#define GTK_IS_VSCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VSCALE))
+#define GTK_IS_VSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSCALE))
+#define GTK_VSCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VSCALE, GtkVScaleClass))
+
+
+typedef struct _GtkVScale GtkVScale;
+typedef struct _GtkVScaleClass GtkVScaleClass;
+
+/**
+ * GtkVScale:
+ *
+ * The #GtkVScale struct contains private data only, and
+ * should be accessed using the functions below.
+ */
+struct _GtkVScale
+{
+ GtkScale scale;
+};
+
+struct _GtkVScaleClass
+{
+ GtkScaleClass parent_class;
+};
+
+
+GType gtk_vscale_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_vscale_new (GtkAdjustment *adjustment);
+GtkWidget* gtk_vscale_new_with_range (gdouble min,
+ gdouble max,
+ gdouble step);
+
+G_END_DECLS
+
+#endif /* __GTK_VSCALE_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkorientable.h"
+#include "gtkscrollbar.h"
+
+#include "gtkvscrollbar.h"
+#include "gtkintl.h"
+
+
+/**
+ * SECTION:gtkvscrollbar
+ * @Short_description: A vertical scrollbar
+ * @Title: GtkVScrollbar
+ * @See_also:#GtkScrollbar, #GtkScrolledWindow
+ *
+ * The #GtkVScrollbar widget is a widget arranged vertically creating a
+ * scrollbar. See #GtkScrollbar for details on
+ * scrollbars. #GtkAdjustment pointers may be added to handle the
+ * adjustment of the scrollbar or it may be left %NULL in which case one
+ * will be created for you. See #GtkScrollbar for a description of what the
+ * fields in an adjustment represent for a scrollbar.
+ *
+ * GtkVScrollbar has been deprecated, use #GtkScrollbar instead.
+ */
+
+G_DEFINE_TYPE (GtkVScrollbar, gtk_vscrollbar, GTK_TYPE_SCROLLBAR)
+
+static void
+gtk_vscrollbar_class_init (GtkVScrollbarClass *class)
+{
+ GTK_RANGE_CLASS (class)->stepper_detail = "vscrollbar";
+}
+
+static void
+gtk_vscrollbar_init (GtkVScrollbar *vscrollbar)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vscrollbar),
+ GTK_ORIENTATION_VERTICAL);
+}
+
+/**
+ * gtk_vscrollbar_new:
+ * @adjustment: (allow-none): the #GtkAdjustment to use, or %NULL to create a new adjustment
+ *
+ * Creates a new vertical scrollbar.
+ *
+ * Returns: the new #GtkVScrollbar
+ *
+ * Deprecated: 3.2: Use gtk_scrollbar_new() with %GTK_ORIENTATION_VERTICAL instead
+ */
+GtkWidget *
+gtk_vscrollbar_new (GtkAdjustment *adjustment)
+{
+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
+ NULL);
+
+ return g_object_new (GTK_TYPE_VSCROLLBAR,
+ "adjustment", adjustment,
+ NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_VSCROLLBAR_H__
+#define __GTK_VSCROLLBAR_H__
+
+#include <gtk/gtkscrollbar.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_VSCROLLBAR (gtk_vscrollbar_get_type ())
+#define GTK_VSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VSCROLLBAR, GtkVScrollbar))
+#define GTK_VSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSCROLLBAR, GtkVScrollbarClass))
+#define GTK_IS_VSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VSCROLLBAR))
+#define GTK_IS_VSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSCROLLBAR))
+#define GTK_VSCROLLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VSCROLLBAR, GtkVScrollbarClass))
+
+
+typedef struct _GtkVScrollbar GtkVScrollbar;
+typedef struct _GtkVScrollbarClass GtkVScrollbarClass;
+
+/**
+ * GtkVScrollbar:
+ *
+ * The #GtkVScrollbar struct contains private data and should be accessed
+ * using the functions below.
+ */
+struct _GtkVScrollbar
+{
+ GtkScrollbar scrollbar;
+};
+
+struct _GtkVScrollbarClass
+{
+ GtkScrollbarClass parent_class;
+};
+
+
+GType gtk_vscrollbar_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_vscrollbar_new (GtkAdjustment *adjustment);
+
+G_END_DECLS
+
+#endif /* __GTK_VSCROLLBAR_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gtkorientable.h"
+
+#include "gtkvseparator.h"
+
+
+/**
+ * SECTION:gtkvseparator
+ * @Short_description: A vertical separator
+ * @Title: GtkVSeparator
+ * @See_also: #GtkHSeparator
+ *
+ * The #GtkVSeparator widget is a vertical separator, used to group the
+ * widgets within a window. It displays a vertical line with a shadow to
+ * make it appear sunken into the interface.
+ *
+ * GtkVSeparator has been deprecated, use #GtkSeparator instead.
+ */
+
+G_DEFINE_TYPE (GtkVSeparator, gtk_vseparator, GTK_TYPE_SEPARATOR)
+
+static void
+gtk_vseparator_class_init (GtkVSeparatorClass *klass)
+{
+}
+
+static void
+gtk_vseparator_init (GtkVSeparator *vseparator)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vseparator),
+ GTK_ORIENTATION_VERTICAL);
+}
+
+/**
+ * gtk_vseparator_new:
+ *
+ * Creates a new #GtkVSeparator.
+ *
+ * Returns: a new #GtkVSeparator.
+ *
+ * Deprecated: 3.2: Use gtk_separator_new() with %GTK_ORIENTATION_VERTICAL instead
+ */
+GtkWidget *
+gtk_vseparator_new (void)
+{
+ return g_object_new (GTK_TYPE_VSEPARATOR, NULL);
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_VSEPARATOR_H__
+#define __GTK_VSEPARATOR_H__
+
+#include <gtk/gtkseparator.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_VSEPARATOR (gtk_vseparator_get_type ())
+#define GTK_VSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VSEPARATOR, GtkVSeparator))
+#define GTK_VSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSEPARATOR, GtkVSeparatorClass))
+#define GTK_IS_VSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VSEPARATOR))
+#define GTK_IS_VSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSEPARATOR))
+#define GTK_VSEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VSEPARATOR, GtkVSeparatorClass))
+
+
+typedef struct _GtkVSeparator GtkVSeparator;
+typedef struct _GtkVSeparatorClass GtkVSeparatorClass;
+
+/**
+ * GtkVSeparator:
+ *
+ * The #GtkVSeparator struct contains private data only, and
+ * should be accessed using the functions below.
+ */
+struct _GtkVSeparator
+{
+ GtkSeparator separator;
+};
+
+struct _GtkVSeparatorClass
+{
+ GtkSeparatorClass parent_class;
+};
+
+
+GType gtk_vseparator_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_vseparator_new (void);
+
+G_END_DECLS
+
+#endif /* __GTK_VSEPARATOR_H__ */
#include <gtk/gtkfilechooserwidget.h>
#include <gtk/gtkfilefilter.h>
#include <gtk/gtkfontbutton.h>
-#include <gtk/gtkfontsel.h>
#include <gtk/gtkfontchooser.h>
#include <gtk/gtkfontchooserdialog.h>
#include <gtk/gtkfontchooserwidget.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkgradient.h>
#include <gtk/gtkgrid.h>
-#include <gtk/gtkhandlebox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkhscale.h>
-#include <gtk/gtkhscrollbar.h>
-#include <gtk/gtkhseparator.h>
#include <gtk/gtkhsv.h>
#include <gtk/gtkiconfactory.h>
#include <gtk/gtkicontheme.h>
#include <gtk/gtkstyle.h>
#include <gtk/gtkswitch.h>
#include <gtk/gtksymboliccolor.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktearoffmenuitem.h>
#include <gtk/gtktextattributes.h>
#include <gtk/gtktextbuffer.h>
#include <gtk/gtktextbufferrichtext.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtktypebuiltins.h>
#include <gtk/gtkuimanager.h>
-#include <gtk/gtkvbbox.h>
-#include <gtk/gtkvbox.h>
#include <gtk/gtkversion.h>
#include <gtk/gtkviewport.h>
#include <gtk/gtkvolumebutton.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkvscale.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtkvseparator.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtkwidgetpath.h>
#include <gtk/gtkwindow.h>
+#ifndef GTK_DISABLE_DEPRECATED
+#include <gtk/deprecated/gtkfontsel.h>
+#include <gtk/deprecated/gtkhandlebox.h>
+#include <gtk/deprecated/gtkhbbox.h>
+#include <gtk/deprecated/gtkhbox.h>
+#include <gtk/deprecated/gtkhpaned.h>
+#include <gtk/deprecated/gtkhscale.h>
+#include <gtk/deprecated/gtkhscrollbar.h>
+#include <gtk/deprecated/gtkhseparator.h>
+#include <gtk/deprecated/gtktable.h>
+#include <gtk/deprecated/gtktearoffmenuitem.h>
+#include <gtk/deprecated/gtkvbbox.h>
+#include <gtk/deprecated/gtkvbox.h>
+#include <gtk/deprecated/gtkvpaned.h>
+#include <gtk/deprecated/gtkvscale.h>
+#include <gtk/deprecated/gtkvscrollbar.h>
+#include <gtk/deprecated/gtkvseparator.h>
+#endif
+
#undef __GTK_H_INSIDE__
#endif /* __GTK_H__ */
#include "gtkmarshalers.h"
#include "gtkmenuitem.h"
#include "gtkstock.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
#include "gtktoolbutton.h"
#include "gtktoolbar.h"
#include "gtkprivate.h"
#include "gtkmenushellprivate.h"
#include "gtkscrolledwindow.h"
#include "gtkseparatormenuitem.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
#include "gtktogglebutton.h"
#include "gtktreeselection.h"
#include "gtkseparator.h"
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * Massively updated for Pango by Owen Taylor, May 2000
- * GtkFontSelection widget for Gtk+, by Damon Chaplin, May 1998.
- * Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
- * The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <glib/gprintf.h>
-#include <string.h>
-
-#include <atk/atk.h>
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include "gtkfontsel.h"
-
-#include "gtkbutton.h"
-#include "gtkcellrenderertext.h"
-#include "gtkentry.h"
-#include "gtkframe.h"
-#include "gtklabel.h"
-#include "gtkliststore.h"
-#include "gtkstock.h"
-#include "gtktable.h"
-#include "gtktreeselection.h"
-#include "gtktreeview.h"
-#include "gtkscrolledwindow.h"
-#include "gtkintl.h"
-#include "gtkaccessible.h"
-#include "gtkbuildable.h"
-#include "gtkorientable.h"
-#include "gtkprivate.h"
-
-
-/**
- * SECTION:gtkfontsel
- * @Short_description: Deprecated widget for selecting fonts
- * @Title: GtkFontSelection
- * @See_also: #GtkFontSelectionDialog, #GtkFontChooser
- *
- * The #GtkFontSelection widget lists the available fonts, styles and sizes,
- * allowing the user to select a font.
- * It is used in the #GtkFontSelectionDialog widget to provide a dialog box for
- * selecting fonts.
- *
- * To set the font which is initially selected, use
- * gtk_font_selection_set_font_name().
- *
- * To get the selected font use gtk_font_selection_get_font_name().
- *
- * To change the text which is shown in the preview area, use
- * gtk_font_selection_set_preview_text().
- *
- * In GTK+ 3.2, #GtkFontSelection has been deprecated in favor of
- * #GtkFontChooser.
- */
-
-
-struct _GtkFontSelectionPrivate
-{
- GtkWidget *font_entry; /* Used _get_family_entry() for consistency, -mr */
- GtkWidget *font_style_entry; /* Used _get_face_entry() for consistency, -mr */
-
- GtkWidget *size_entry;
- GtkWidget *preview_entry;
-
- GtkWidget *family_list;
- GtkWidget *face_list;
- GtkWidget *size_list;
-
- PangoFontFamily *family; /* Current family */
- PangoFontFace *face; /* Current face */
-
- gint size;
-};
-
-
-struct _GtkFontSelectionDialogPrivate
-{
- GtkWidget *fontsel;
-
- GtkWidget *ok_button;
- GtkWidget *apply_button;
- GtkWidget *cancel_button;
-};
-
-
-/* We don't enable the font and style entries because they don't add
- * much in terms of visible effect and have a weird effect on keynav.
- * the Windows font selector has entries similarly positioned but they
- * act in conjunction with the associated lists to form a single focus
- * location.
- */
-#undef INCLUDE_FONT_ENTRIES
-
-/* This is the default text shown in the preview entry, though the user
- can set it. Remember that some fonts only have capital letters. */
-#define PREVIEW_TEXT N_("abcdefghijk ABCDEFGHIJK")
-
-#define DEFAULT_FONT_NAME "Sans 10"
-
-/* This is the initial and maximum height of the preview entry (it expands
- when large font sizes are selected). Initial height is also the minimum. */
-#define INITIAL_PREVIEW_HEIGHT 44
-#define MAX_PREVIEW_HEIGHT 300
-
-/* These are the sizes of the font, style & size lists. */
-#define FONT_LIST_HEIGHT 136
-#define FONT_LIST_WIDTH 190
-#define FONT_STYLE_LIST_WIDTH 170
-#define FONT_SIZE_LIST_WIDTH 60
-
-/* These are what we use as the standard font sizes, for the size list.
- */
-static const guint16 font_sizes[] = {
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28,
- 32, 36, 40, 48, 56, 64, 72
-};
-
-enum {
- PROP_0,
- PROP_FONT_NAME,
- PROP_PREVIEW_TEXT
-};
-
-
-enum {
- FAMILY_COLUMN,
- FAMILY_NAME_COLUMN
-};
-
-enum {
- FACE_COLUMN,
- FACE_NAME_COLUMN
-};
-
-enum {
- SIZE_COLUMN
-};
-
-static void gtk_font_selection_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_font_selection_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void gtk_font_selection_finalize (GObject *object);
-static void gtk_font_selection_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen);
-static void gtk_font_selection_style_updated (GtkWidget *widget);
-
-/* These are the callbacks & related functions. */
-static void gtk_font_selection_select_font (GtkTreeSelection *selection,
- gpointer data);
-static void gtk_font_selection_show_available_fonts (GtkFontSelection *fs);
-
-static void gtk_font_selection_show_available_styles (GtkFontSelection *fs);
-static void gtk_font_selection_select_best_style (GtkFontSelection *fs,
- gboolean use_first);
-static void gtk_font_selection_select_style (GtkTreeSelection *selection,
- gpointer data);
-
-static void gtk_font_selection_select_best_size (GtkFontSelection *fs);
-static void gtk_font_selection_show_available_sizes (GtkFontSelection *fs,
- gboolean first_time);
-static void gtk_font_selection_size_activate (GtkWidget *w,
- gpointer data);
-static gboolean gtk_font_selection_size_focus_out (GtkWidget *w,
- GdkEventFocus *event,
- gpointer data);
-static void gtk_font_selection_select_size (GtkTreeSelection *selection,
- gpointer data);
-
-static void gtk_font_selection_scroll_on_map (GtkWidget *w,
- gpointer data);
-
-static void gtk_font_selection_preview_changed (GtkWidget *entry,
- GtkFontSelection *fontsel);
-static void gtk_font_selection_scroll_to_selection (GtkFontSelection *fontsel);
-
-
-/* Misc. utility functions. */
-static void gtk_font_selection_load_font (GtkFontSelection *fs);
-static void gtk_font_selection_update_preview (GtkFontSelection *fs);
-
-static PangoFontDescription *gtk_font_selection_get_font_description (GtkFontSelection *fontsel);
-static gboolean gtk_font_selection_select_font_desc (GtkFontSelection *fontsel,
- PangoFontDescription *new_desc,
- PangoFontFamily **pfamily,
- PangoFontFace **pface);
-static void gtk_font_selection_reload_fonts (GtkFontSelection *fontsel);
-static void gtk_font_selection_ref_family (GtkFontSelection *fontsel,
- PangoFontFamily *family);
-static void gtk_font_selection_ref_face (GtkFontSelection *fontsel,
- PangoFontFace *face);
-
-G_DEFINE_TYPE (GtkFontSelection, gtk_font_selection, GTK_TYPE_BOX)
-
-static void
-gtk_font_selection_class_init (GtkFontSelectionClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- gobject_class->finalize = gtk_font_selection_finalize;
- gobject_class->set_property = gtk_font_selection_set_property;
- gobject_class->get_property = gtk_font_selection_get_property;
-
- widget_class->screen_changed = gtk_font_selection_screen_changed;
- widget_class->style_updated = gtk_font_selection_style_updated;
-
- g_object_class_install_property (gobject_class,
- PROP_FONT_NAME,
- g_param_spec_string ("font-name",
- P_("Font name"),
- P_("The string that represents this font"),
- DEFAULT_FONT_NAME,
- GTK_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_PREVIEW_TEXT,
- g_param_spec_string ("preview-text",
- P_("Preview text"),
- P_("The text to display in order to demonstrate the selected font"),
- _(PREVIEW_TEXT),
- GTK_PARAM_READWRITE));
-
- g_type_class_add_private (klass, sizeof (GtkFontSelectionPrivate));
-}
-
-static void
-gtk_font_selection_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkFontSelection *fontsel;
-
- fontsel = GTK_FONT_SELECTION (object);
-
- switch (prop_id)
- {
- case PROP_FONT_NAME:
- gtk_font_selection_set_font_name (fontsel, g_value_get_string (value));
- break;
- case PROP_PREVIEW_TEXT:
- gtk_font_selection_set_preview_text (fontsel, g_value_get_string (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void gtk_font_selection_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkFontSelection *fontsel;
-
- fontsel = GTK_FONT_SELECTION (object);
-
- switch (prop_id)
- {
- case PROP_FONT_NAME:
- g_value_take_string (value, gtk_font_selection_get_font_name (fontsel));
- break;
- case PROP_PREVIEW_TEXT:
- g_value_set_string (value, gtk_font_selection_get_preview_text (fontsel));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* Handles key press events on the lists, so that we can trap Enter to
- * activate the default button on our own.
- */
-static gboolean
-list_row_activated (GtkWidget *widget)
-{
- GtkWidget *default_widget, *focus_widget;
- GtkWindow *window;
-
- window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
- if (!gtk_widget_is_toplevel (GTK_WIDGET (window)))
- window = NULL;
-
- if (window)
- {
- default_widget = gtk_window_get_default_widget (window);
- focus_widget = gtk_window_get_focus (window);
-
- if (widget != default_widget &&
- !(widget == focus_widget && (!default_widget || !gtk_widget_get_sensitive (default_widget))))
- gtk_window_activate_default (window);
- }
-
- return TRUE;
-}
-
-static void
-gtk_font_selection_init (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv;
- GtkWidget *scrolled_win;
- GtkWidget *text_box;
- GtkWidget *table, *label;
- GtkWidget *font_label, *style_label;
- GtkWidget *vbox;
- GtkListStore *model;
- GtkTreeViewColumn *column;
- GList *focus_chain = NULL;
- AtkObject *atk_obj;
-
- fontsel->priv = G_TYPE_INSTANCE_GET_PRIVATE (fontsel,
- GTK_TYPE_FONT_SELECTION,
- GtkFontSelectionPrivate);
- priv = fontsel->priv;
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (fontsel),
- GTK_ORIENTATION_VERTICAL);
-
- gtk_widget_push_composite_child ();
-
- gtk_box_set_spacing (GTK_BOX (fontsel), 12);
- priv->size = 12 * PANGO_SCALE;
-
- /* Create the table of font, style & size. */
- table = gtk_table_new (3, 3, FALSE);
- gtk_widget_show (table);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
- gtk_box_pack_start (GTK_BOX (fontsel), table, TRUE, TRUE, 0);
-
-#ifdef INCLUDE_FONT_ENTRIES
- priv->font_entry = gtk_entry_new ();
- gtk_editable_set_editable (GTK_EDITABLE (priv->font_entry), FALSE);
- gtk_widget_set_size_request (priv->font_entry, 20, -1);
- gtk_widget_show (priv->font_entry);
- gtk_table_attach (GTK_TABLE (table), priv->font_entry, 0, 1, 1, 2,
- GTK_FILL, 0, 0, 0);
-
- priv->font_style_entry = gtk_entry_new ();
- gtk_editable_set_editable (GTK_EDITABLE (priv->font_style_entry), FALSE);
- gtk_widget_set_size_request (priv->font_style_entry, 20, -1);
- gtk_widget_show (priv->font_style_entry);
- gtk_table_attach (GTK_TABLE (table), priv->font_style_entry, 1, 2, 1, 2,
- GTK_FILL, 0, 0, 0);
-#endif /* INCLUDE_FONT_ENTRIES */
-
- priv->size_entry = gtk_entry_new ();
- gtk_widget_set_size_request (priv->size_entry, 20, -1);
- gtk_widget_show (priv->size_entry);
- gtk_table_attach (GTK_TABLE (table), priv->size_entry, 2, 3, 1, 2,
- GTK_FILL, 0, 0, 0);
- g_signal_connect (priv->size_entry, "activate",
- G_CALLBACK (gtk_font_selection_size_activate),
- fontsel);
- g_signal_connect_after (priv->size_entry, "focus-out-event",
- G_CALLBACK (gtk_font_selection_size_focus_out),
- fontsel);
-
- font_label = gtk_label_new_with_mnemonic (_("_Family:"));
- gtk_widget_set_halign (font_label, GTK_ALIGN_START);
- gtk_widget_set_valign (font_label, GTK_ALIGN_CENTER);
- gtk_widget_show (font_label);
- gtk_table_attach (GTK_TABLE (table), font_label, 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
-
- style_label = gtk_label_new_with_mnemonic (_("_Style:"));
- gtk_widget_set_halign (style_label, GTK_ALIGN_START);
- gtk_widget_set_valign (style_label, GTK_ALIGN_CENTER);
- gtk_widget_show (style_label);
- gtk_table_attach (GTK_TABLE (table), style_label, 1, 2, 0, 1,
- GTK_FILL, 0, 0, 0);
-
- label = gtk_label_new_with_mnemonic (_("Si_ze:"));
- gtk_label_set_mnemonic_widget (GTK_LABEL (label),
- priv->size_entry);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
- GTK_FILL, 0, 0, 0);
-
-
- /* Create the lists */
-
- model = gtk_list_store_new (2,
- G_TYPE_OBJECT, /* FAMILY_COLUMN */
- G_TYPE_STRING); /* FAMILY_NAME_COLUMN */
- priv->family_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
- g_object_unref (model);
-
- g_signal_connect (priv->family_list, "row-activated",
- G_CALLBACK (list_row_activated), fontsel);
-
- column = gtk_tree_view_column_new_with_attributes ("Family",
- gtk_cell_renderer_text_new (),
- "text", FAMILY_NAME_COLUMN,
- NULL);
- gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (priv->family_list), column);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->family_list), FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list)),
- GTK_SELECTION_BROWSE);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (font_label), priv->family_list);
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
- gtk_widget_set_size_request (scrolled_win,
- FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
- gtk_container_add (GTK_CONTAINER (scrolled_win), priv->family_list);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- gtk_widget_show (priv->family_list);
- gtk_widget_show (scrolled_win);
-
- gtk_table_attach (GTK_TABLE (table), scrolled_win, 0, 1, 1, 3,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL, 0, 0);
- focus_chain = g_list_append (focus_chain, scrolled_win);
-
- model = gtk_list_store_new (2,
- G_TYPE_OBJECT, /* FACE_COLUMN */
- G_TYPE_STRING); /* FACE_NAME_COLUMN */
- priv->face_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
- g_object_unref (model);
- g_signal_connect (priv->face_list, "row-activated",
- G_CALLBACK (list_row_activated), fontsel);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (style_label), priv->face_list);
-
- column = gtk_tree_view_column_new_with_attributes ("Face",
- gtk_cell_renderer_text_new (),
- "text", FACE_NAME_COLUMN,
- NULL);
- gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (priv->face_list), column);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->face_list), FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list)),
- GTK_SELECTION_BROWSE);
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
- gtk_widget_set_size_request (scrolled_win,
- FONT_STYLE_LIST_WIDTH, FONT_LIST_HEIGHT);
- gtk_container_add (GTK_CONTAINER (scrolled_win), priv->face_list);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- gtk_widget_show (priv->face_list);
- gtk_widget_show (scrolled_win);
- gtk_table_attach (GTK_TABLE (table), scrolled_win, 1, 2, 1, 3,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL, 0, 0);
- focus_chain = g_list_append (focus_chain, scrolled_win);
-
- focus_chain = g_list_append (focus_chain, priv->size_entry);
-
- model = gtk_list_store_new (1, G_TYPE_INT);
- priv->size_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
- g_object_unref (model);
- g_signal_connect (priv->size_list, "row-activated",
- G_CALLBACK (list_row_activated), fontsel);
-
- column = gtk_tree_view_column_new_with_attributes ("Size",
- gtk_cell_renderer_text_new (),
- "text", SIZE_COLUMN,
- NULL);
- gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (priv->size_list), column);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->size_list), FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list)),
- GTK_SELECTION_BROWSE);
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (scrolled_win), priv->size_list);
- gtk_widget_set_size_request (scrolled_win, -1, FONT_LIST_HEIGHT);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
- gtk_widget_show (priv->size_list);
- gtk_widget_show (scrolled_win);
- gtk_table_attach (GTK_TABLE (table), scrolled_win, 2, 3, 2, 3,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- focus_chain = g_list_append (focus_chain, scrolled_win);
-
- gtk_container_set_focus_chain (GTK_CONTAINER (table), focus_chain);
- g_list_free (focus_chain);
-
- /* Insert the fonts. */
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list)), "changed",
- G_CALLBACK (gtk_font_selection_select_font), fontsel);
-
- g_signal_connect_after (priv->family_list, "map",
- G_CALLBACK (gtk_font_selection_scroll_on_map),
- fontsel);
-
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list)), "changed",
- G_CALLBACK (gtk_font_selection_select_style), fontsel);
-
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list)), "changed",
- G_CALLBACK (gtk_font_selection_select_size), fontsel);
- atk_obj = gtk_widget_get_accessible (priv->size_list);
- if (GTK_IS_ACCESSIBLE (atk_obj))
- {
- /* Accessibility support is enabled.
- * Make the label ATK_RELATON_LABEL_FOR for the size list as well.
- */
- AtkObject *atk_label;
- AtkRelationSet *relation_set;
- AtkRelation *relation;
- AtkObject *obj_array[1];
-
- atk_label = gtk_widget_get_accessible (label);
- relation_set = atk_object_ref_relation_set (atk_obj);
- relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABELLED_BY);
- if (relation)
- {
- atk_relation_add_target (relation, atk_label);
- }
- else
- {
- obj_array[0] = atk_label;
- relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABELLED_BY);
- atk_relation_set_add (relation_set, relation);
- }
- g_object_unref (relation_set);
-
- relation_set = atk_object_ref_relation_set (atk_label);
- relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABEL_FOR);
- if (relation)
- {
- atk_relation_add_target (relation, atk_obj);
- }
- else
- {
- obj_array[0] = atk_obj;
- relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABEL_FOR);
- atk_relation_set_add (relation_set, relation);
- }
- g_object_unref (relation_set);
- }
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_widget_show (vbox);
- gtk_box_pack_start (GTK_BOX (fontsel), vbox, FALSE, TRUE, 0);
-
- /* create the text entry widget */
- label = gtk_label_new_with_mnemonic (_("_Preview:"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-
- text_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_show (text_box);
- gtk_box_pack_start (GTK_BOX (vbox), text_box, FALSE, TRUE, 0);
-
- priv->preview_entry = gtk_entry_new ();
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->preview_entry);
- gtk_entry_set_text (GTK_ENTRY (priv->preview_entry), _(PREVIEW_TEXT));
-
- gtk_widget_show (priv->preview_entry);
- g_signal_connect (priv->preview_entry, "changed",
- G_CALLBACK (gtk_font_selection_preview_changed), fontsel);
- gtk_widget_set_size_request (priv->preview_entry,
- -1, INITIAL_PREVIEW_HEIGHT);
- gtk_box_pack_start (GTK_BOX (text_box), priv->preview_entry,
- TRUE, TRUE, 0);
- gtk_widget_pop_composite_child();
-}
-
-/**
- * gtk_font_selection_new:
- *
- * Creates a new #GtkFontSelection.
- *
- * Return value: a n ew #GtkFontSelection
- */
-GtkWidget *
-gtk_font_selection_new (void)
-{
- GtkFontSelection *fontsel;
-
- fontsel = g_object_new (GTK_TYPE_FONT_SELECTION, NULL);
-
- return GTK_WIDGET (fontsel);
-}
-
-static void
-gtk_font_selection_finalize (GObject *object)
-{
- GtkFontSelection *fontsel = GTK_FONT_SELECTION (object);
-
- gtk_font_selection_ref_family (fontsel, NULL);
- gtk_font_selection_ref_face (fontsel, NULL);
-
- G_OBJECT_CLASS (gtk_font_selection_parent_class)->finalize (object);
-}
-
-static void
-gtk_font_selection_ref_family (GtkFontSelection *fontsel,
- PangoFontFamily *family)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
-
- if (family)
- family = g_object_ref (family);
- if (priv->family)
- g_object_unref (priv->family);
- priv->family = family;
-}
-
-static void gtk_font_selection_ref_face (GtkFontSelection *fontsel,
- PangoFontFace *face)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
-
- if (face)
- face = g_object_ref (face);
- if (priv->face)
- g_object_unref (priv->face);
- priv->face = face;
-}
-
-static void
-gtk_font_selection_reload_fonts (GtkFontSelection *fontsel)
-{
- if (gtk_widget_has_screen (GTK_WIDGET (fontsel)))
- {
- PangoFontDescription *desc;
- desc = gtk_font_selection_get_font_description (fontsel);
-
- gtk_font_selection_show_available_fonts (fontsel);
- gtk_font_selection_show_available_sizes (fontsel, TRUE);
- gtk_font_selection_show_available_styles (fontsel);
-
- gtk_font_selection_select_font_desc (fontsel, desc, NULL, NULL);
- gtk_font_selection_scroll_to_selection (fontsel);
-
- pango_font_description_free (desc);
- }
-}
-
-static void
-gtk_font_selection_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen)
-{
- gtk_font_selection_reload_fonts (GTK_FONT_SELECTION (widget));
-}
-
-static void
-gtk_font_selection_style_updated (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (gtk_font_selection_parent_class)->style_updated (widget);
-
- /* Maybe fonts where installed or removed... */
- gtk_font_selection_reload_fonts (GTK_FONT_SELECTION (widget));
-}
-
-static void
-gtk_font_selection_preview_changed (GtkWidget *entry,
- GtkFontSelection *fontsel)
-{
- g_object_notify (G_OBJECT (fontsel), "preview-text");
-}
-
-static void
-scroll_to_selection (GtkTreeView *tree_view)
-{
- GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
- gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5, 0.5);
- gtk_tree_path_free (path);
- }
-}
-
-static void
-set_cursor_to_iter (GtkTreeView *view,
- GtkTreeIter *iter)
-{
- GtkTreeModel *model = gtk_tree_view_get_model (view);
- GtkTreePath *path = gtk_tree_model_get_path (model, iter);
-
- gtk_tree_view_set_cursor (view, path, NULL, FALSE);
-
- gtk_tree_path_free (path);
-}
-
-static void
-gtk_font_selection_scroll_to_selection (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
-
- /* Try to scroll the font family list to the selected item */
- scroll_to_selection (GTK_TREE_VIEW (priv->family_list));
-
- /* Try to scroll the font family list to the selected item */
- scroll_to_selection (GTK_TREE_VIEW (priv->face_list));
-
- /* Try to scroll the font family list to the selected item */
- scroll_to_selection (GTK_TREE_VIEW (priv->size_list));
-/* This is called when the list is mapped. Here we scroll to the current
- font if necessary. */
-}
-
-static void
-gtk_font_selection_scroll_on_map (GtkWidget *widget,
- gpointer data)
-{
- gtk_font_selection_scroll_to_selection (GTK_FONT_SELECTION (data));
-}
-
-/* This is called when a family is selected in the list. */
-static void
-gtk_font_selection_select_font (GtkTreeSelection *selection,
- gpointer data)
-{
- GtkFontSelection *fontsel;
- GtkFontSelectionPrivate *priv;
- GtkTreeModel *model;
- GtkTreeIter iter;
-#ifdef INCLUDE_FONT_ENTRIES
- const gchar *family_name;
-#endif
-
- fontsel = GTK_FONT_SELECTION (data);
- priv = fontsel->priv;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- PangoFontFamily *family;
-
- gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
- if (priv->family != family)
- {
- gtk_font_selection_ref_family (fontsel, family);
-
-#ifdef INCLUDE_FONT_ENTRIES
- family_name = pango_font_family_get_name (priv->family);
- gtk_entry_set_text (GTK_ENTRY (priv->font_entry), family_name);
-#endif
-
- gtk_font_selection_show_available_styles (fontsel);
- gtk_font_selection_select_best_style (fontsel, TRUE);
- }
-
- g_object_unref (family);
- }
-}
-
-static int
-cmp_families (const void *a, const void *b)
-{
- const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
- const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
-
- return g_utf8_collate (a_name, b_name);
-}
-
-static void
-gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- GtkListStore *model;
- PangoFontFamily **families;
- PangoFontFamily *match_family = NULL;
- gint n_families, i;
- GtkTreeIter match_row;
-
- model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->family_list)));
-
- pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)),
- &families, &n_families);
- qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
-
- gtk_list_store_clear (model);
-
- for (i=0; i<n_families; i++)
- {
- const gchar *name = pango_font_family_get_name (families[i]);
- GtkTreeIter iter;
-
- gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter,
- FAMILY_COLUMN, families[i],
- FAMILY_NAME_COLUMN, name,
- -1);
-
- if (i == 0 || !g_ascii_strcasecmp (name, "sans"))
- {
- match_family = families[i];
- match_row = iter;
- }
- }
-
- gtk_font_selection_ref_family (fontsel, match_family);
- if (match_family)
- {
- set_cursor_to_iter (GTK_TREE_VIEW (priv->family_list), &match_row);
-#ifdef INCLUDE_FONT_ENTRIES
- gtk_entry_set_text (GTK_ENTRY (priv->font_entry),
- pango_font_family_get_name (match_family));
-#endif /* INCLUDE_FONT_ENTRIES */
- }
-
- g_free (families);
-}
-
-static int
-compare_font_descriptions (const PangoFontDescription *a, const PangoFontDescription *b)
-{
- int val = strcmp (pango_font_description_get_family (a), pango_font_description_get_family (b));
- if (val != 0)
- return val;
-
- if (pango_font_description_get_weight (a) != pango_font_description_get_weight (b))
- return pango_font_description_get_weight (a) - pango_font_description_get_weight (b);
-
- if (pango_font_description_get_style (a) != pango_font_description_get_style (b))
- return pango_font_description_get_style (a) - pango_font_description_get_style (b);
-
- if (pango_font_description_get_stretch (a) != pango_font_description_get_stretch (b))
- return pango_font_description_get_stretch (a) - pango_font_description_get_stretch (b);
-
- if (pango_font_description_get_variant (a) != pango_font_description_get_variant (b))
- return pango_font_description_get_variant (a) - pango_font_description_get_variant (b);
-
- return 0;
-}
-
-static int
-faces_sort_func (const void *a, const void *b)
-{
- PangoFontDescription *desc_a = pango_font_face_describe (*(PangoFontFace **)a);
- PangoFontDescription *desc_b = pango_font_face_describe (*(PangoFontFace **)b);
-
- int ord = compare_font_descriptions (desc_a, desc_b);
-
- pango_font_description_free (desc_a);
- pango_font_description_free (desc_b);
-
- return ord;
-}
-
-static gboolean
-font_description_style_equal (const PangoFontDescription *a,
- const PangoFontDescription *b)
-{
- return (pango_font_description_get_weight (a) == pango_font_description_get_weight (b) &&
- pango_font_description_get_style (a) == pango_font_description_get_style (b) &&
- pango_font_description_get_stretch (a) == pango_font_description_get_stretch (b) &&
- pango_font_description_get_variant (a) == pango_font_description_get_variant (b));
-}
-
-/* This fills the font style list with all the possible style combinations
- for the current font family. */
-static void
-gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- gint n_faces, i;
- PangoFontFace **faces;
- PangoFontDescription *old_desc;
- GtkListStore *model;
- GtkTreeIter match_row;
- PangoFontFace *match_face = NULL;
-
- model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list)));
-
- if (priv->face)
- old_desc = pango_font_face_describe (priv->face);
- else
- old_desc= NULL;
-
- pango_font_family_list_faces (priv->family, &faces, &n_faces);
- qsort (faces, n_faces, sizeof (PangoFontFace *), faces_sort_func);
-
- gtk_list_store_clear (model);
-
- for (i=0; i < n_faces; i++)
- {
- GtkTreeIter iter;
- const gchar *str = pango_font_face_get_face_name (faces[i]);
-
- gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter,
- FACE_COLUMN, faces[i],
- FACE_NAME_COLUMN, str,
- -1);
-
- if (i == 0)
- {
- match_row = iter;
- match_face = faces[i];
- }
- else if (old_desc)
- {
- PangoFontDescription *tmp_desc = pango_font_face_describe (faces[i]);
-
- if (font_description_style_equal (tmp_desc, old_desc))
- {
- match_row = iter;
- match_face = faces[i];
- }
-
- pango_font_description_free (tmp_desc);
- }
- }
-
- if (old_desc)
- pango_font_description_free (old_desc);
-
- gtk_font_selection_ref_face (fontsel, match_face);
- if (match_face)
- {
-#ifdef INCLUDE_FONT_ENTRIES
- const gchar *str = pango_font_face_get_face_name (priv->face);
-
- gtk_entry_set_text (GTK_ENTRY (priv->font_style_entry), str);
-#endif
- set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &match_row);
- }
-
- g_free (faces);
-}
-
-/* This selects a style when the user selects a font. It just uses the first
- available style at present. I was thinking of trying to maintain the
- selected style, e.g. bold italic, when the user selects different fonts.
- However, the interface is so easy to use now I'm not sure it's worth it.
- Note: This will load a font. */
-static void
-gtk_font_selection_select_best_style (GtkFontSelection *fontsel,
- gboolean use_first)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- GtkTreeIter iter;
- GtkTreeModel *model;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list));
-
- if (gtk_tree_model_get_iter_first (model, &iter))
- {
- set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &iter);
- scroll_to_selection (GTK_TREE_VIEW (priv->face_list));
- }
-
- gtk_font_selection_show_available_sizes (fontsel, FALSE);
- gtk_font_selection_select_best_size (fontsel);
-}
-
-
-/* This is called when a style is selected in the list. */
-static void
-gtk_font_selection_select_style (GtkTreeSelection *selection,
- gpointer data)
-{
- GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- PangoFontFace *face;
-
- gtk_tree_model_get (model, &iter, FACE_COLUMN, &face, -1);
- gtk_font_selection_ref_face (fontsel, face);
- g_object_unref (face);
- }
-
- gtk_font_selection_show_available_sizes (fontsel, FALSE);
- gtk_font_selection_select_best_size (fontsel);
-}
-
-static void
-gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
- gboolean first_time)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- gint i;
- GtkListStore *model;
- gchar buffer[128];
- gchar *p;
-
- model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->size_list)));
-
- /* Insert the standard font sizes */
- if (first_time)
- {
- gtk_list_store_clear (model);
-
- for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
- {
- GtkTreeIter iter;
-
- gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter, SIZE_COLUMN, font_sizes[i], -1);
-
- if (font_sizes[i] * PANGO_SCALE == priv->size)
- set_cursor_to_iter (GTK_TREE_VIEW (priv->size_list), &iter);
- }
- }
- else
- {
- GtkTreeIter iter;
- gboolean found = FALSE;
-
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter);
- for (i = 0; i < G_N_ELEMENTS (font_sizes) && !found; i++)
- {
- if (font_sizes[i] * PANGO_SCALE == priv->size)
- {
- set_cursor_to_iter (GTK_TREE_VIEW (priv->size_list), &iter);
- found = TRUE;
- }
-
- gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter);
- }
-
- if (!found)
- {
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list));
- gtk_tree_selection_unselect_all (selection);
- }
- }
-
- /* Set the entry to the new size, rounding to 1 digit,
- * trimming of trailing 0's and a trailing period
- */
- g_snprintf (buffer, sizeof (buffer), "%.1f", priv->size / (1.0 * PANGO_SCALE));
- if (strchr (buffer, '.'))
- {
- p = buffer + strlen (buffer) - 1;
- while (*p == '0')
- p--;
- if (*p == '.')
- p--;
- p[1] = '\0';
- }
-
- /* Compare, to avoid moving the cursor unecessarily */
- if (strcmp (gtk_entry_get_text (GTK_ENTRY (priv->size_entry)), buffer) != 0)
- gtk_entry_set_text (GTK_ENTRY (priv->size_entry), buffer);
-}
-
-static void
-gtk_font_selection_select_best_size (GtkFontSelection *fontsel)
-{
- gtk_font_selection_load_font (fontsel);
-}
-
-static void
-gtk_font_selection_set_size (GtkFontSelection *fontsel,
- gint new_size)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
-
- if (priv->size != new_size)
- {
- priv->size = new_size;
-
- gtk_font_selection_show_available_sizes (fontsel, FALSE);
- gtk_font_selection_load_font (fontsel);
- }
-}
-
-/* If the user hits return in the font size entry, we change to the new font
- size. */
-static void
-gtk_font_selection_size_activate (GtkWidget *w,
- gpointer data)
-{
- GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
- GtkFontSelectionPrivate *priv = fontsel->priv;
- gint new_size;
- const gchar *text;
-
- text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
- new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
-
- if (priv->size != new_size)
- gtk_font_selection_set_size (fontsel, new_size);
- else
- list_row_activated (w);
-}
-
-static gboolean
-gtk_font_selection_size_focus_out (GtkWidget *w,
- GdkEventFocus *event,
- gpointer data)
-{
- GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
- GtkFontSelectionPrivate *priv = fontsel->priv;
- gint new_size;
- const gchar *text;
-
- text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
- new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
-
- gtk_font_selection_set_size (fontsel, new_size);
-
- return TRUE;
-}
-
-/* This is called when a size is selected in the list. */
-static void
-gtk_font_selection_select_size (GtkTreeSelection *selection,
- gpointer data)
-{
- GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
- GtkTreeModel *model;
- GtkTreeIter iter;
- gint new_size;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
- gtk_font_selection_set_size (fontsel, new_size * PANGO_SCALE);
- }
-}
-
-static void
-gtk_font_selection_load_font (GtkFontSelection *fontsel)
-{
- gtk_font_selection_update_preview (fontsel);
-}
-
-static PangoFontDescription *
-gtk_font_selection_get_font_description (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- PangoFontDescription *font_desc;
-
- if (priv->face)
- {
- font_desc = pango_font_face_describe (priv->face);
- pango_font_description_set_size (font_desc, priv->size);
- }
- else
- font_desc = pango_font_description_from_string (DEFAULT_FONT_NAME);
-
- return font_desc;
-}
-
-/* This sets the font in the preview entry to the selected font,
- * and tries to make sure that the preview entry is a reasonable
- * size, i.e. so that the text can be seen with a bit of space to
- * spare. But it tries to avoid resizing the entry every time the
- * font changes. This also used to shrink the preview if the font
- * size was decreased, but that made it awkward if the user wanted
- * to resize the window themself.
- */
-static void
-gtk_font_selection_update_preview (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- gint new_height;
- GtkRequisition old_requisition, new_requisition;
- GtkWidget *preview_entry = priv->preview_entry;
- const gchar *text;
-
- gtk_widget_get_preferred_size (preview_entry, &old_requisition, NULL);
-
- gtk_widget_override_font (preview_entry,
- gtk_font_selection_get_font_description (fontsel));
-
- gtk_widget_get_preferred_size (preview_entry, &new_requisition, NULL);
-
- /* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
- new_height = CLAMP (new_requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
-
- if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
- gtk_widget_set_size_request (preview_entry, -1, new_height);
-
- /* This sets the preview text, if it hasn't been set already. */
- text = gtk_entry_get_text (GTK_ENTRY (preview_entry));
- if (strlen (text) == 0)
- gtk_entry_set_text (GTK_ENTRY (preview_entry), _(PREVIEW_TEXT));
- gtk_editable_set_position (GTK_EDITABLE (preview_entry), 0);
-}
-
-
-/*****************************************************************************
- * These functions are the main public interface for getting/setting the font.
- *****************************************************************************/
-
-/**
- * gtk_font_selection_get_family_list:
- * @fontsel: a #GtkFontSelection
- *
- * This returns the #GtkTreeView that lists font families, for
- * example, 'Sans', 'Serif', etc.
- *
- * Return value: (transfer none): A #GtkWidget that is part of @fontsel
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-GtkWidget *
-gtk_font_selection_get_family_list (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->family_list;
-}
-
-/**
- * gtk_font_selection_get_face_list:
- * @fontsel: a #GtkFontSelection
- *
- * This returns the #GtkTreeView which lists all styles available for
- * the selected font. For example, 'Regular', 'Bold', etc.
- *
- * Return value: (transfer none): A #GtkWidget that is part of @fontsel
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-GtkWidget *
-gtk_font_selection_get_face_list (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->face_list;
-}
-
-/**
- * gtk_font_selection_get_size_entry:
- * @fontsel: a #GtkFontSelection
- *
- * This returns the #GtkEntry used to allow the user to edit the font
- * number manually instead of selecting it from the list of font sizes.
- *
- * Return value: (transfer none): A #GtkWidget that is part of @fontsel
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-GtkWidget *
-gtk_font_selection_get_size_entry (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->size_entry;
-}
-
-/**
- * gtk_font_selection_get_size_list:
- * @fontsel: a #GtkFontSelection
- *
- * This returns the #GtkTreeeView used to list font sizes.
- *
- * Return value: (transfer none): A #GtkWidget that is part of @fontsel
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-GtkWidget *
-gtk_font_selection_get_size_list (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->size_list;
-}
-
-/**
- * gtk_font_selection_get_preview_entry:
- * @fontsel: a #GtkFontSelection
- *
- * This returns the #GtkEntry used to display the font as a preview.
- *
- * Return value: (transfer none): A #GtkWidget that is part of @fontsel
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-GtkWidget *
-gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->preview_entry;
-}
-
-/**
- * gtk_font_selection_get_family:
- * @fontsel: a #GtkFontSelection
- *
- * Gets the #PangoFontFamily representing the selected font family.
- *
- * Return value: (transfer none): A #PangoFontFamily representing the
- * selected font family. Font families are a collection of font
- * faces. The returned object is owned by @fontsel and must not
- * be modified or freed.
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-PangoFontFamily *
-gtk_font_selection_get_family (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->family;
-}
-
-/**
- * gtk_font_selection_get_face:
- * @fontsel: a #GtkFontSelection
- *
- * Gets the #PangoFontFace representing the selected font group
- * details (i.e. family, slant, weight, width, etc).
- *
- * Return value: (transfer none): A #PangoFontFace representing the
- * selected font group details. The returned object is owned by
- * @fontsel and must not be modified or freed.
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-PangoFontFace *
-gtk_font_selection_get_face (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- return fontsel->priv->face;
-}
-
-/**
- * gtk_font_selection_get_size:
- * @fontsel: a #GtkFontSelection
- *
- * The selected font size.
- *
- * Return value: A n integer representing the selected font size,
- * or -1 if no font size is selected.
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- **/
-gint
-gtk_font_selection_get_size (GtkFontSelection *fontsel)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), -1);
-
- return fontsel->priv->size;
-}
-
-/**
- * gtk_font_selection_get_font_name:
- * @fontsel: a #GtkFontSelection
- *
- * Gets the currently-selected font name.
- *
- * Note that this can be a different string than what you set with
- * gtk_font_selection_set_font_name(), as the font selection widget may
- * normalize font names and thus return a string with a different structure.
- * For example, "Helvetica Italic Bold 12" could be normalized to
- * "Helvetica Bold Italic 12". Use pango_font_description_equal()
- * if you want to compare two font descriptions.
- *
- * Return value: A string with the name of the current font, or %NULL if
- * no font is selected. You must free this string with g_free().
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-gchar *
-gtk_font_selection_get_font_name (GtkFontSelection *fontsel)
-{
- gchar *result;
-
- PangoFontDescription *font_desc = gtk_font_selection_get_font_description (fontsel);
- result = pango_font_description_to_string (font_desc);
- pango_font_description_free (font_desc);
-
- return result;
-}
-
-/* This selects the appropriate list rows.
- First we check the fontname is valid and try to find the font family
- - i.e. the name in the main list. If we can't find that, then just return.
- Next we try to set each of the properties according to the fontname.
- Finally we select the font family & style in the lists. */
-static gboolean
-gtk_font_selection_select_font_desc (GtkFontSelection *fontsel,
- PangoFontDescription *new_desc,
- PangoFontFamily **pfamily,
- PangoFontFace **pface)
-{
- GtkFontSelectionPrivate *priv = fontsel->priv;
- PangoFontFamily *new_family = NULL;
- PangoFontFace *new_face = NULL;
- PangoFontFace *fallback_face = NULL;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreeIter match_iter;
- gboolean valid;
- const gchar *new_family_name;
-
- new_family_name = pango_font_description_get_family (new_desc);
-
- if (!new_family_name)
- return FALSE;
-
- /* Check to make sure that this is in the list of allowed fonts
- */
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->family_list));
- for (valid = gtk_tree_model_get_iter_first (model, &iter);
- valid;
- valid = gtk_tree_model_iter_next (model, &iter))
- {
- PangoFontFamily *family;
-
- gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
-
- if (g_ascii_strcasecmp (pango_font_family_get_name (family),
- new_family_name) == 0)
- new_family = g_object_ref (family);
-
- g_object_unref (family);
-
- if (new_family)
- break;
- }
-
- if (!new_family)
- return FALSE;
-
- if (pfamily)
- *pfamily = new_family;
- else
- g_object_unref (new_family);
- set_cursor_to_iter (GTK_TREE_VIEW (priv->family_list), &iter);
- gtk_font_selection_show_available_styles (fontsel);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list));
- for (valid = gtk_tree_model_get_iter_first (model, &iter);
- valid;
- valid = gtk_tree_model_iter_next (model, &iter))
- {
- PangoFontFace *face;
- PangoFontDescription *tmp_desc;
-
- gtk_tree_model_get (model, &iter, FACE_COLUMN, &face, -1);
- tmp_desc = pango_font_face_describe (face);
-
- if (font_description_style_equal (tmp_desc, new_desc))
- new_face = g_object_ref (face);
-
- if (!fallback_face)
- {
- fallback_face = g_object_ref (face);
- match_iter = iter;
- }
-
- pango_font_description_free (tmp_desc);
- g_object_unref (face);
-
- if (new_face)
- {
- match_iter = iter;
- break;
- }
- }
-
- if (!new_face)
- new_face = fallback_face;
- else if (fallback_face)
- g_object_unref (fallback_face);
-
- if (pface)
- *pface = new_face;
- else if (new_face)
- g_object_unref (new_face);
- set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &match_iter);
-
- gtk_font_selection_set_size (fontsel, pango_font_description_get_size (new_desc));
-
- return TRUE;
-}
-
-
-/* This sets the current font, then selecting the appropriate list rows. */
-
-/**
- * gtk_font_selection_set_font_name:
- * @fontsel: a #GtkFontSelection
- * @fontname: a font name like "Helvetica 12" or "Times Bold 18"
- *
- * Sets the currently-selected font.
- *
- * Note that the @fontsel needs to know the screen in which it will appear
- * for this to work; this can be guaranteed by simply making sure that the
- * @fontsel is inserted in a toplevel window before you call this function.
- *
- * Return value: %TRUE if the font could be set successfully; %FALSE if no
- * such font exists or if the @fontsel doesn't belong to a particular
- * screen yet.
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-gboolean
-gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
- const gchar *fontname)
-{
- PangoFontFamily *family = NULL;
- PangoFontFace *face = NULL;
- PangoFontDescription *new_desc;
-
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), FALSE);
-
- if (!gtk_widget_has_screen (GTK_WIDGET (fontsel)))
- return FALSE;
-
- new_desc = pango_font_description_from_string (fontname);
-
- if (gtk_font_selection_select_font_desc (fontsel, new_desc, &family, &face))
- {
- gtk_font_selection_ref_family (fontsel, family);
- if (family)
- g_object_unref (family);
-
- gtk_font_selection_ref_face (fontsel, face);
- if (face)
- g_object_unref (face);
- }
-
- pango_font_description_free (new_desc);
-
- g_object_notify (G_OBJECT (fontsel), "font-name");
-
- return TRUE;
-}
-
-/**
- * gtk_font_selection_get_preview_text:
- * @fontsel: a #GtkFontSelection
- *
- * Gets the text displayed in the preview area.
- *
- * Return value: the text displayed in the preview area.
- * This string is owned by the widget and should not be
- * modified or freed
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-const gchar*
-gtk_font_selection_get_preview_text (GtkFontSelection *fontsel)
-{
- GtkFontSelectionPrivate *priv;
-
- g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
- priv = fontsel->priv;
-
- return gtk_entry_get_text (GTK_ENTRY (priv->preview_entry));
-}
-
-
-/**
- * gtk_font_selection_set_preview_text:
- * @fontsel: a #GtkFontSelection
- * @text: the text to display in the preview area
- *
- * Sets the text displayed in the preview area.
- * The @text is used to show how the selected font looks.
- *
- * Deprecated: 3.2: Use #GtkFontChooser
- */
-void
-gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
- const gchar *text)
-{
- GtkFontSelectionPrivate *priv;
-
- g_return_if_fail (GTK_IS_FONT_SELECTION (fontsel));
- g_return_if_fail (text != NULL);
-
- priv = fontsel->priv;
-
- gtk_entry_set_text (GTK_ENTRY (priv->preview_entry), text);
-}
-
-
-/**
- * SECTION:gtkfontseldlg
- * @Short_description: A dialog box for selecting fonts
- * @Title: GtkFontSelectionDialog
- * @See_also: #GtkFontSelection, #GtkDialog, #GtkFontChooserDialog
- *
- * The #GtkFontSelectionDialog widget is a dialog box for selecting a font.
- *
- * To set the font which is initially selected, use
- * gtk_font_selection_dialog_set_font_name().
- *
- * To get the selected font use gtk_font_selection_dialog_get_font_name().
- *
- * To change the text which is shown in the preview area, use
- * gtk_font_selection_dialog_set_preview_text().
- *
- * In GTK+ 3.2, #GtkFontSelectionDialog has been deprecated in favor of
- * #GtkFontChooserDialog.
- *
- * <refsect2 id="GtkFontSelectionDialog-BUILDER-UI">
- * <title>GtkFontSelectionDialog as GtkBuildable</title>
- * The GtkFontSelectionDialog implementation of the GtkBuildable interface
- * exposes the embedded #GtkFontSelection as internal child with the
- * name "font_selection". It also exposes the buttons with the names
- * "ok_button", "cancel_button" and "apply_button".
- * </refsect2>
- */
-
-static void gtk_font_selection_dialog_buildable_interface_init (GtkBuildableIface *iface);
-static GObject * gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
- GtkBuilder *builder,
- const gchar *childname);
-
-G_DEFINE_TYPE_WITH_CODE (GtkFontSelectionDialog, gtk_font_selection_dialog,
- GTK_TYPE_DIALOG,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_font_selection_dialog_buildable_interface_init))
-
-static GtkBuildableIface *parent_buildable_iface;
-
-static void
-gtk_font_selection_dialog_class_init (GtkFontSelectionDialogClass *klass)
-{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FONT_CHOOSER);
-
- g_type_class_add_private (klass, sizeof (GtkFontSelectionDialogPrivate));
-}
-
-static void
-gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
-{
- GtkFontSelectionDialogPrivate *priv;
- GtkDialog *dialog = GTK_DIALOG (fontseldiag);
- GtkWidget *action_area, *content_area;
-
- fontseldiag->priv = G_TYPE_INSTANCE_GET_PRIVATE (fontseldiag,
- GTK_TYPE_FONT_SELECTION_DIALOG,
- GtkFontSelectionDialogPrivate);
- priv = fontseldiag->priv;
-
- content_area = gtk_dialog_get_content_area (dialog);
- action_area = gtk_dialog_get_action_area (dialog);
-
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
- gtk_box_set_spacing (GTK_BOX (action_area), 6);
-
- gtk_widget_push_composite_child ();
-
- gtk_window_set_resizable (GTK_WINDOW (fontseldiag), TRUE);
-
- /* Create the content area */
- priv->fontsel = gtk_font_selection_new ();
- gtk_container_set_border_width (GTK_CONTAINER (priv->fontsel), 5);
- gtk_widget_show (priv->fontsel);
- gtk_box_pack_start (GTK_BOX (content_area),
- priv->fontsel, TRUE, TRUE, 0);
-
- /* Create the action area */
- priv->cancel_button = gtk_dialog_add_button (dialog,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL);
-
- priv->apply_button = gtk_dialog_add_button (dialog,
- GTK_STOCK_APPLY,
- GTK_RESPONSE_APPLY);
- gtk_widget_hide (priv->apply_button);
-
- priv->ok_button = gtk_dialog_add_button (dialog,
- GTK_STOCK_OK,
- GTK_RESPONSE_OK);
- gtk_widget_grab_default (priv->ok_button);
-
- gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontseldiag),
- GTK_RESPONSE_OK,
- GTK_RESPONSE_APPLY,
- GTK_RESPONSE_CANCEL,
- -1);
-
- gtk_window_set_title (GTK_WINDOW (fontseldiag),
- _("Font Selection"));
-
- gtk_widget_pop_composite_child ();
-}
-
-/**
- * gtk_font_selection_dialog_new:
- * @title: the title of the dialog window
- *
- * Creates a new #GtkFontSelectionDialog.
- *
- * Return value: a new #GtkFontSelectionDialog
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-GtkWidget*
-gtk_font_selection_dialog_new (const gchar *title)
-{
- GtkFontSelectionDialog *fontseldiag;
-
- fontseldiag = g_object_new (GTK_TYPE_FONT_SELECTION_DIALOG, NULL);
-
- if (title)
- gtk_window_set_title (GTK_WINDOW (fontseldiag), title);
-
- return GTK_WIDGET (fontseldiag);
-}
-
-/**
- * gtk_font_selection_dialog_get_font_selection:
- * @fsd: a #GtkFontSelectionDialog
- *
- * Retrieves the #GtkFontSelection widget embedded in the dialog.
- *
- * Returns: (transfer none): the embedded #GtkFontSelection
- *
- * Since: 2.22
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- **/
-GtkWidget*
-gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
-
- return fsd->priv->fontsel;
-}
-
-
-/**
- * gtk_font_selection_dialog_get_ok_button:
- * @fsd: a #GtkFontSelectionDialog
- *
- * Gets the 'OK' button.
- *
- * Return value: (transfer none): the #GtkWidget used in the dialog
- * for the 'OK' button.
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-GtkWidget *
-gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
-
- return fsd->priv->ok_button;
-}
-
-/**
- * gtk_font_selection_dialog_get_cancel_button:
- * @fsd: a #GtkFontSelectionDialog
- *
- * Gets the 'Cancel' button.
- *
- * Return value: (transfer none): the #GtkWidget used in the dialog
- * for the 'Cancel' button.
- *
- * Since: 2.14
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-GtkWidget *
-gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd)
-{
- g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
-
- return fsd->priv->cancel_button;
-}
-
-static void
-gtk_font_selection_dialog_buildable_interface_init (GtkBuildableIface *iface)
-{
- parent_buildable_iface = g_type_interface_peek_parent (iface);
- iface->get_internal_child = gtk_font_selection_dialog_buildable_get_internal_child;
-}
-
-static GObject *
-gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
- GtkBuilder *builder,
- const gchar *childname)
-{
- GtkFontSelectionDialogPrivate *priv;
-
- priv = GTK_FONT_SELECTION_DIALOG (buildable)->priv;
-
- if (g_strcmp0 (childname, "ok_button") == 0)
- return G_OBJECT (priv->ok_button);
- else if (g_strcmp0 (childname, "cancel_button") == 0)
- return G_OBJECT (priv->cancel_button);
- else if (g_strcmp0 (childname, "apply_button") == 0)
- return G_OBJECT (priv->apply_button);
- else if (g_strcmp0 (childname, "font_selection") == 0)
- return G_OBJECT (priv->fontsel);
-
- return parent_buildable_iface->get_internal_child (buildable, builder, childname);
-}
-
-/**
- * gtk_font_selection_dialog_get_font_name:
- * @fsd: a #GtkFontSelectionDialog
- *
- * Gets the currently-selected font name.
- *
- * Note that this can be a different string than what you set with
- * gtk_font_selection_dialog_set_font_name(), as the font selection widget
- * may normalize font names and thus return a string with a different
- * structure. For example, "Helvetica Italic Bold 12" could be normalized
- * to "Helvetica Bold Italic 12". Use pango_font_description_equal()
- * if you want to compare two font descriptions.
- *
- * Return value: A string with the name of the current font, or %NULL if no
- * font is selected. You must free this string with g_free().
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-gchar*
-gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd)
-{
- GtkFontSelectionDialogPrivate *priv;
-
- g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
-
- priv = fsd->priv;
-
- return gtk_font_selection_get_font_name (GTK_FONT_SELECTION (priv->fontsel));
-}
-
-/**
- * gtk_font_selection_dialog_set_font_name:
- * @fsd: a #GtkFontSelectionDialog
- * @fontname: a font name like "Helvetica 12" or "Times Bold 18"
- *
- * Sets the currently selected font.
- *
- * Return value: %TRUE if the font selected in @fsd is now the
- * @fontname specified, %FALSE otherwise.
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-gboolean
-gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
- const gchar *fontname)
-{
- GtkFontSelectionDialogPrivate *priv;
-
- g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), FALSE);
- g_return_val_if_fail (fontname, FALSE);
-
- priv = fsd->priv;
-
- return gtk_font_selection_set_font_name (GTK_FONT_SELECTION (priv->fontsel), fontname);
-}
-
-/**
- * gtk_font_selection_dialog_get_preview_text:
- * @fsd: a #GtkFontSelectionDialog
- *
- * Gets the text displayed in the preview area.
- *
- * Return value: the text displayed in the preview area.
- * This string is owned by the widget and should not be
- * modified or freed
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-const gchar*
-gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd)
-{
- GtkFontSelectionDialogPrivate *priv;
-
- g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
-
- priv = fsd->priv;
-
- return gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (priv->fontsel));
-}
-
-/**
- * gtk_font_selection_dialog_set_preview_text:
- * @fsd: a #GtkFontSelectionDialog
- * @text: the text to display in the preview area
- *
- * Sets the text displayed in the preview area.
- *
- * Deprecated: 3.2: Use #GtkFontChooserDialog
- */
-void
-gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
- const gchar *text)
-{
- GtkFontSelectionDialogPrivate *priv;
-
- g_return_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd));
- g_return_if_fail (text != NULL);
-
- priv = fsd->priv;
-
- gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (priv->fontsel), text);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * GtkFontSelection widget for Gtk+, by Damon Chaplin, May 1998.
- * Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
- * The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_FONTSEL_H__
-#define __GTK_FONTSEL_H__
-
-
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkbox.h>
-
-
-G_BEGIN_DECLS
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define GTK_TYPE_FONT_SELECTION (gtk_font_selection_get_type ())
-#define GTK_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelection))
-#define GTK_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
-#define GTK_IS_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION))
-#define GTK_IS_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION))
-#define GTK_FONT_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
-
-
-#define GTK_TYPE_FONT_SELECTION_DIALOG (gtk_font_selection_dialog_get_type ())
-#define GTK_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialog))
-#define GTK_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
-#define GTK_IS_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION_DIALOG))
-#define GTK_IS_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION_DIALOG))
-#define GTK_FONT_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
-
-
-typedef struct _GtkFontSelection GtkFontSelection;
-typedef struct _GtkFontSelectionPrivate GtkFontSelectionPrivate;
-typedef struct _GtkFontSelectionClass GtkFontSelectionClass;
-
-typedef struct _GtkFontSelectionDialog GtkFontSelectionDialog;
-typedef struct _GtkFontSelectionDialogPrivate GtkFontSelectionDialogPrivate;
-typedef struct _GtkFontSelectionDialogClass GtkFontSelectionDialogClass;
-
-struct _GtkFontSelection
-{
- GtkBox parent_instance;
-
- /*< private >*/
- GtkFontSelectionPrivate *priv;
-};
-
-struct _GtkFontSelectionClass
-{
- GtkBoxClass parent_class;
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-
-struct _GtkFontSelectionDialog
-{
- GtkDialog parent_instance;
-
- /*< private >*/
- GtkFontSelectionDialogPrivate *priv;
-};
-
-struct _GtkFontSelectionDialogClass
-{
- GtkDialogClass parent_class;
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-
-
-/*****************************************************************************
- * GtkFontSelection functions.
- * see the comments in the GtkFontSelectionDialog functions.
- *****************************************************************************/
-
-GType gtk_font_selection_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget * gtk_font_selection_new (void);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget * gtk_font_selection_get_family_list (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget * gtk_font_selection_get_face_list (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget * gtk_font_selection_get_size_entry (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget * gtk_font_selection_get_size_list (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget * gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-PangoFontFamily *
- gtk_font_selection_get_family (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-PangoFontFace *
- gtk_font_selection_get_face (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-gint gtk_font_selection_get_size (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-gchar* gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
-
-GDK_DEPRECATED_FOR(GtkFontChooser)
-gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
- const gchar *fontname);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-const gchar* gtk_font_selection_get_preview_text (GtkFontSelection *fontsel);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-void gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
- const gchar *text);
-
-/*****************************************************************************
- * GtkFontSelectionDialog functions.
- * most of these functions simply call the corresponding function in the
- * GtkFontSelection.
- *****************************************************************************/
-
-GType gtk_font_selection_dialog_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget *gtk_font_selection_dialog_new (const gchar *title);
-
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget *gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget *gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd);
-GDK_DEPRECATED_FOR(GtkFontChooser)
-GtkWidget *gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd);
-
-/* This returns the X Logical Font Description fontname, or NULL if no font
- is selected. Note that there is a slight possibility that the font might not
- have been loaded OK. You should call gtk_font_selection_dialog_get_font()
- to see if it has been loaded OK.
- You should g_free() the returned font name after you're done with it. */
-GDK_DEPRECATED_FOR(GtkFontChooser)
-gchar* gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd);
-
-/* This sets the currently displayed font. It should be a valid X Logical
- Font Description font name (anything else will be ignored), e.g.
- "-adobe-courier-bold-o-normal--25-*-*-*-*-*-*-*"
- It returns TRUE on success. */
-GDK_DEPRECATED_FOR(GtkFontChooser)
-gboolean gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
- const gchar *fontname);
-
-/* This returns the text in the preview entry. You should copy the returned
- text if you need it. */
-GDK_DEPRECATED_FOR(GtkFontChooser)
-const gchar*
- gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd);
-
-/* This sets the text in the preview entry. It will be copied by the entry,
- so there's no need to g_strdup() it first. */
-GDK_DEPRECATED_FOR(GtkFontChooser)
-void gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
- const gchar *text);
-
-
-#endif /* GTK_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-
-#endif /* __GTK_FONTSEL_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include "gtkhandlebox.h"
-#include "gtkinvisible.h"
-#include "gtkmain.h"
-#include "gtkmarshalers.h"
-#include "gtkwindow.h"
-#include "gtktypebuiltins.h"
-#include "gtkprivate.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtkhandlebox
- * @Short_description: a widget for detachable window portions
- * @Title: GtkHandleBox
- *
- * The #GtkHandleBox widget allows a portion of a window to be "torn
- * off". It is a bin widget which displays its child and a handle that
- * the user can drag to tear off a separate window (the <firstterm>float
- * window</firstterm>) containing the child widget. A thin
- * <firstterm>ghost</firstterm> is drawn in the original location of the
- * handlebox. By dragging the separate window back to its original
- * location, it can be reattached.
- *
- * When reattaching, the ghost and float window, must be aligned
- * along one of the edges, the <firstterm>snap edge</firstterm>.
- * This either can be specified by the application programmer
- * explicitely, or GTK+ will pick a reasonable default based
- * on the handle position.
- *
- * To make detaching and reattaching the handlebox as minimally confusing
- * as possible to the user, it is important to set the snap edge so that
- * the snap edge does not move when the handlebox is deattached. For
- * instance, if the handlebox is packed at the bottom of a VBox, then
- * when the handlebox is detached, the bottom edge of the handlebox's
- * allocation will remain fixed as the height of the handlebox shrinks,
- * so the snap edge should be set to %GTK_POS_BOTTOM.
- *
- * <note>
- * #GtkHandleBox has been deprecated. It is very specialized, lacks features
- * to make it useful and most importantly does not fit well into modern
- * application design. Do not use it. There is no replacement.
- * </note>
- */
-
-
-struct _GtkHandleBoxPrivate
-{
- /* Properties */
- GtkPositionType handle_position;
- GtkPositionType snap_edge;
- GtkShadowType shadow_type;
- gboolean child_detached;
- /* Properties */
-
- GtkAllocation attach_allocation;
- GtkAllocation float_allocation;
-
- GdkDevice *grab_device;
-
- GdkWindow *bin_window; /* parent window for children */
- GdkWindow *float_window;
-
- /* Variables used during a drag
- */
- gint orig_x;
- gint orig_y;
-
- guint float_window_mapped : 1;
- guint in_drag : 1;
- guint shrink_on_detach : 1;
-};
-
-enum {
- PROP_0,
- PROP_SHADOW_TYPE,
- PROP_HANDLE_POSITION,
- PROP_SNAP_EDGE,
- PROP_SNAP_EDGE_SET,
- PROP_CHILD_DETACHED
-};
-
-#define DRAG_HANDLE_SIZE 10
-#define CHILDLESS_SIZE 25
-#define GHOST_HEIGHT 3
-#define TOLERANCE 5
-
-enum {
- SIGNAL_CHILD_ATTACHED,
- SIGNAL_CHILD_DETACHED,
- SIGNAL_LAST
-};
-
-/* The algorithm for docking and redocking implemented here
- * has a couple of nice properties:
- *
- * 1) During a single drag, docking always occurs at the
- * the same cursor position. This means that the users
- * motions are reversible, and that you won't
- * undock/dock oscillations.
- *
- * 2) Docking generally occurs at user-visible features.
- * The user, once they figure out to redock, will
- * have useful information about doing it again in
- * the future.
- *
- * Please try to preserve these properties if you
- * change the algorithm. (And the current algorithm
- * is far from ideal). Briefly, the current algorithm
- * for deciding whether the handlebox is docked or not:
- *
- * 1) The decision is done by comparing two rectangles - the
- * allocation if the widget at the start of the drag,
- * and the boundary of hb->bin_window at the start of
- * of the drag offset by the distance that the cursor
- * has moved.
- *
- * 2) These rectangles must have one edge, the "snap_edge"
- * of the handlebox, aligned within TOLERANCE.
- *
- * 3) On the other dimension, the extents of one rectangle
- * must be contained in the extents of the other,
- * extended by tolerance. That is, either we can have:
- *
- * <-TOLERANCE-|--------bin_window--------------|-TOLERANCE->
- * <--------float_window-------------------->
- *
- * or we can have:
- *
- * <-TOLERANCE-|------float_window--------------|-TOLERANCE->
- * <--------bin_window-------------------->
- */
-
-static void gtk_handle_box_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_handle_box_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void gtk_handle_box_map (GtkWidget *widget);
-static void gtk_handle_box_unmap (GtkWidget *widget);
-static void gtk_handle_box_realize (GtkWidget *widget);
-static void gtk_handle_box_unrealize (GtkWidget *widget);
-static void gtk_handle_box_style_updated (GtkWidget *widget);
-static void gtk_handle_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_handle_box_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_handle_box_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_handle_box_size_allocate (GtkWidget *widget,
- GtkAllocation *real_allocation);
-static void gtk_handle_box_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_handle_box_remove (GtkContainer *container,
- GtkWidget *widget);
-static gboolean gtk_handle_box_draw (GtkWidget *widget,
- cairo_t *cr);
-static gboolean gtk_handle_box_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gboolean gtk_handle_box_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gboolean gtk_handle_box_delete_event (GtkWidget *widget,
- GdkEventAny *event);
-static void gtk_handle_box_reattach (GtkHandleBox *hb);
-static void gtk_handle_box_end_drag (GtkHandleBox *hb,
- guint32 time);
-
-static guint handle_box_signals[SIGNAL_LAST] = { 0 };
-
-G_DEFINE_TYPE (GtkHandleBox, gtk_handle_box, GTK_TYPE_BIN)
-
-static void
-gtk_handle_box_class_init (GtkHandleBoxClass *class)
-{
- GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- gobject_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- gobject_class->set_property = gtk_handle_box_set_property;
- gobject_class->get_property = gtk_handle_box_get_property;
-
- g_object_class_install_property (gobject_class,
- PROP_SHADOW_TYPE,
- g_param_spec_enum ("shadow-type",
- P_("Shadow type"),
- P_("Appearance of the shadow that surrounds the container"),
- GTK_TYPE_SHADOW_TYPE,
- GTK_SHADOW_OUT,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_HANDLE_POSITION,
- g_param_spec_enum ("handle-position",
- P_("Handle position"),
- P_("Position of the handle relative to the child widget"),
- GTK_TYPE_POSITION_TYPE,
- GTK_POS_LEFT,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_SNAP_EDGE,
- g_param_spec_enum ("snap-edge",
- P_("Snap edge"),
- P_("Side of the handlebox that's lined up with the docking point to dock the handlebox"),
- GTK_TYPE_POSITION_TYPE,
- GTK_POS_TOP,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_SNAP_EDGE_SET,
- g_param_spec_boolean ("snap-edge-set",
- P_("Snap edge set"),
- P_("Whether to use the value from the snap_edge property or a value derived from handle_position"),
- FALSE,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_CHILD_DETACHED,
- g_param_spec_boolean ("child-detached",
- P_("Child Detached"),
- P_("A boolean value indicating whether the handlebox's child is attached or detached."),
- FALSE,
- GTK_PARAM_READABLE));
-
- widget_class->map = gtk_handle_box_map;
- widget_class->unmap = gtk_handle_box_unmap;
- widget_class->realize = gtk_handle_box_realize;
- widget_class->unrealize = gtk_handle_box_unrealize;
- widget_class->style_updated = gtk_handle_box_style_updated;
- widget_class->get_preferred_width = gtk_handle_box_get_preferred_width;
- widget_class->get_preferred_height = gtk_handle_box_get_preferred_height;
- widget_class->size_allocate = gtk_handle_box_size_allocate;
- widget_class->draw = gtk_handle_box_draw;
- widget_class->button_press_event = gtk_handle_box_button_press;
- widget_class->delete_event = gtk_handle_box_delete_event;
-
- container_class->add = gtk_handle_box_add;
- container_class->remove = gtk_handle_box_remove;
-
- class->child_attached = NULL;
- class->child_detached = NULL;
-
- /**
- * GtkHandleBox::child-attached:
- * @handlebox: the object which received the signal.
- * @widget: the child widget of the handlebox.
- * (this argument provides no extra information
- * and is here only for backwards-compatibility)
- *
- * This signal is emitted when the contents of the
- * handlebox are reattached to the main window.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- */
- handle_box_signals[SIGNAL_CHILD_ATTACHED] =
- g_signal_new (I_("child-attached"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkHandleBoxClass, child_attached),
- NULL, NULL,
- _gtk_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
-
- /**
- * GtkHandleBox::child-detached:
- * @handlebox: the object which received the signal.
- * @widget: the child widget of the handlebox.
- * (this argument provides no extra information
- * and is here only for backwards-compatibility)
- *
- * This signal is emitted when the contents of the
- * handlebox are detached from the main window.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- */
- handle_box_signals[SIGNAL_CHILD_DETACHED] =
- g_signal_new (I_("child-detached"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkHandleBoxClass, child_detached),
- NULL, NULL,
- _gtk_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
-
- g_type_class_add_private (gobject_class, sizeof (GtkHandleBoxPrivate));
-}
-
-static void
-gtk_handle_box_init (GtkHandleBox *handle_box)
-{
- GtkHandleBoxPrivate *priv;
- GtkStyleContext *context;
-
- handle_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (handle_box,
- GTK_TYPE_HANDLE_BOX,
- GtkHandleBoxPrivate);
- priv = handle_box->priv;
-
- gtk_widget_set_has_window (GTK_WIDGET (handle_box), TRUE);
-
- priv->bin_window = NULL;
- priv->float_window = NULL;
- priv->shadow_type = GTK_SHADOW_OUT;
- priv->handle_position = GTK_POS_LEFT;
- priv->float_window_mapped = FALSE;
- priv->child_detached = FALSE;
- priv->in_drag = FALSE;
- priv->shrink_on_detach = TRUE;
- priv->snap_edge = -1;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (handle_box));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_DOCK);
-}
-
-static void
-gtk_handle_box_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkHandleBox *handle_box = GTK_HANDLE_BOX (object);
-
- switch (prop_id)
- {
- case PROP_SHADOW_TYPE:
- gtk_handle_box_set_shadow_type (handle_box, g_value_get_enum (value));
- break;
- case PROP_HANDLE_POSITION:
- gtk_handle_box_set_handle_position (handle_box, g_value_get_enum (value));
- break;
- case PROP_SNAP_EDGE:
- gtk_handle_box_set_snap_edge (handle_box, g_value_get_enum (value));
- break;
- case PROP_SNAP_EDGE_SET:
- if (!g_value_get_boolean (value))
- gtk_handle_box_set_snap_edge (handle_box, (GtkPositionType)-1);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gtk_handle_box_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkHandleBox *handle_box = GTK_HANDLE_BOX (object);
- GtkHandleBoxPrivate *priv = handle_box->priv;
-
- switch (prop_id)
- {
- case PROP_SHADOW_TYPE:
- g_value_set_enum (value, priv->shadow_type);
- break;
- case PROP_HANDLE_POSITION:
- g_value_set_enum (value, priv->handle_position);
- break;
- case PROP_SNAP_EDGE:
- g_value_set_enum (value,
- (priv->snap_edge == -1 ?
- GTK_POS_TOP : priv->snap_edge));
- break;
- case PROP_SNAP_EDGE_SET:
- g_value_set_boolean (value, priv->snap_edge != -1);
- break;
- case PROP_CHILD_DETACHED:
- g_value_set_boolean (value, priv->child_detached);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * gtk_handle_box_new:
- *
- * Create a new handle box.
- *
- * Returns: a new #GtkHandleBox.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- */
-GtkWidget*
-gtk_handle_box_new (void)
-{
- return g_object_new (GTK_TYPE_HANDLE_BOX, NULL);
-}
-
-static void
-gtk_handle_box_map (GtkWidget *widget)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkBin *bin = GTK_BIN (widget);
- GtkWidget *child;
-
- gtk_widget_set_mapped (widget, TRUE);
-
- child = gtk_bin_get_child (bin);
- if (child != NULL &&
- gtk_widget_get_visible (child) &&
- !gtk_widget_get_mapped (child))
- gtk_widget_map (child);
-
- if (priv->child_detached && !priv->float_window_mapped)
- {
- gdk_window_show (priv->float_window);
- priv->float_window_mapped = TRUE;
- }
-
- gdk_window_show (priv->bin_window);
- gdk_window_show (gtk_widget_get_window (widget));
-}
-
-static void
-gtk_handle_box_unmap (GtkWidget *widget)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
-
- gtk_widget_set_mapped (widget, FALSE);
-
- gdk_window_hide (gtk_widget_get_window (widget));
- if (priv->float_window_mapped)
- {
- gdk_window_hide (priv->float_window);
- priv->float_window_mapped = FALSE;
- }
-
- GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->unmap (widget);
-}
-
-static void
-gtk_handle_box_realize (GtkWidget *widget)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkAllocation allocation;
- GtkRequisition requisition;
- GtkStyleContext *context;
- GtkWidget *child;
- GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- gtk_widget_set_realized (widget, TRUE);
-
- gtk_widget_get_allocation (widget, &allocation);
-
- attributes.x = allocation.x;
- attributes.y = allocation.y;
- attributes.width = allocation.width;
- attributes.height = allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-
- window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gtk_widget_set_window (widget, window);
- gdk_window_set_user_data (window, widget);
-
- attributes.x = 0;
- attributes.y = 0;
- attributes.width = allocation.width;
- attributes.height = allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON1_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-
- priv->bin_window = gdk_window_new (window,
- &attributes, attributes_mask);
- gdk_window_set_user_data (priv->bin_window, widget);
-
- child = gtk_bin_get_child (GTK_BIN (hb));
- if (child)
- gtk_widget_set_parent_window (child, priv->bin_window);
-
- gtk_widget_get_preferred_size (widget, &requisition, NULL);
-
- attributes.x = 0;
- attributes.y = 0;
- attributes.width = requisition.width;
- attributes.height = requisition.height;
- attributes.window_type = GDK_WINDOW_TOPLEVEL;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_KEY_PRESS_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_FOCUS_CHANGE_MASK
- | GDK_STRUCTURE_MASK);
- attributes.type_hint = GDK_WINDOW_TYPE_HINT_TOOLBAR;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_TYPE_HINT;
- priv->float_window = gdk_window_new (gtk_widget_get_root_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (priv->float_window, widget);
- gdk_window_set_decorations (priv->float_window, 0);
- gdk_window_set_type_hint (priv->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_background (context, window);
- gtk_style_context_set_background (context, priv->bin_window);
- gtk_style_context_set_background (context, priv->float_window);
-}
-
-static void
-gtk_handle_box_unrealize (GtkWidget *widget)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
-
- gdk_window_set_user_data (priv->bin_window, NULL);
- gdk_window_destroy (priv->bin_window);
- priv->bin_window = NULL;
- gdk_window_set_user_data (priv->float_window, NULL);
- gdk_window_destroy (priv->float_window);
- priv->float_window = NULL;
-
- GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->unrealize (widget);
-}
-
-static void
-gtk_handle_box_style_updated (GtkWidget *widget)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
-
- GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->style_updated (widget);
-
- if (gtk_widget_get_realized (widget) &&
- gtk_widget_get_has_window (widget))
- {
- GtkStateFlags state;
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
- gtk_style_context_save (context);
- gtk_style_context_set_state (context, state);
-
- gtk_style_context_set_background (context, gtk_widget_get_window (widget));
- gtk_style_context_set_background (context, priv->bin_window);
- gtk_style_context_set_background (context, priv->float_window);
-
- gtk_style_context_restore (context);
- }
-}
-
-static int
-effective_handle_position (GtkHandleBox *hb)
-{
- GtkHandleBoxPrivate *priv = hb->priv;
- int handle_position;
-
- if (gtk_widget_get_direction (GTK_WIDGET (hb)) == GTK_TEXT_DIR_LTR)
- handle_position = priv->handle_position;
- else
- {
- switch (priv->handle_position)
- {
- case GTK_POS_LEFT:
- handle_position = GTK_POS_RIGHT;
- break;
- case GTK_POS_RIGHT:
- handle_position = GTK_POS_LEFT;
- break;
- default:
- handle_position = priv->handle_position;
- break;
- }
- }
-
- return handle_position;
-}
-
-static void
-gtk_handle_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBin *bin = GTK_BIN (widget);
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkRequisition child_requisition;
- GtkWidget *child;
- gint handle_position;
-
- handle_position = effective_handle_position (hb);
-
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- {
- requisition->width = DRAG_HANDLE_SIZE;
- requisition->height = 0;
- }
- else
- {
- requisition->width = 0;
- requisition->height = DRAG_HANDLE_SIZE;
- }
-
- child = gtk_bin_get_child (bin);
- /* if our child is not visible, we still request its size, since we
- * won't have any useful hint for our size otherwise.
- */
- if (child)
- {
- gtk_widget_get_preferred_size (child, &child_requisition, NULL);
- }
- else
- {
- child_requisition.width = 0;
- child_requisition.height = 0;
- }
-
- if (priv->child_detached)
- {
- /* FIXME: This doesn't work currently */
- if (!priv->shrink_on_detach)
- {
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- requisition->height += child_requisition.height;
- else
- requisition->width += child_requisition.width;
- }
- else
- {
- GtkStyleContext *context;
- GtkStateFlags state;
- GtkBorder padding;
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get_padding (context, state, &padding);
-
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- requisition->height += padding.top;
- else
- requisition->width += padding.left;
- }
- }
- else
- {
- guint border_width;
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- requisition->width += border_width * 2;
- requisition->height += border_width * 2;
-
- if (child)
- {
- requisition->width += child_requisition.width;
- requisition->height += child_requisition.height;
- }
- else
- {
- requisition->width += CHILDLESS_SIZE;
- requisition->height += CHILDLESS_SIZE;
- }
- }
-}
-
-static void
-gtk_handle_box_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_handle_box_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.width;
-}
-
-static void
-gtk_handle_box_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_handle_box_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.height;
-}
-
-
-static void
-gtk_handle_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin = GTK_BIN (widget);
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkRequisition child_requisition;
- GtkWidget *child;
- gint handle_position;
-
- handle_position = effective_handle_position (hb);
-
- child = gtk_bin_get_child (bin);
-
- if (child)
- {
- gtk_widget_get_preferred_size (child, &child_requisition, NULL);
- }
- else
- {
- child_requisition.width = 0;
- child_requisition.height = 0;
- }
-
- gtk_widget_set_allocation (widget, allocation);
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (gtk_widget_get_window (widget),
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- if (child != NULL && gtk_widget_get_visible (child))
- {
- GtkAllocation child_allocation;
- guint border_width;
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- child_allocation.x = border_width;
- child_allocation.y = border_width;
- if (handle_position == GTK_POS_LEFT)
- child_allocation.x += DRAG_HANDLE_SIZE;
- else if (handle_position == GTK_POS_TOP)
- child_allocation.y += DRAG_HANDLE_SIZE;
-
- if (priv->child_detached)
- {
- guint float_width;
- guint float_height;
-
- child_allocation.width = child_requisition.width;
- child_allocation.height = child_requisition.height;
-
- float_width = child_allocation.width + 2 * border_width;
- float_height = child_allocation.height + 2 * border_width;
-
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- float_width += DRAG_HANDLE_SIZE;
- else
- float_height += DRAG_HANDLE_SIZE;
-
- if (gtk_widget_get_realized (widget))
- {
- gdk_window_resize (priv->float_window,
- float_width,
- float_height);
- gdk_window_move_resize (priv->bin_window,
- 0,
- 0,
- float_width,
- float_height);
- }
- }
- else
- {
- child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width);
- child_allocation.height = MAX (1, (gint) allocation->height - 2 * border_width);
-
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- child_allocation.width -= DRAG_HANDLE_SIZE;
- else
- child_allocation.height -= DRAG_HANDLE_SIZE;
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (priv->bin_window,
- 0,
- 0,
- allocation->width,
- allocation->height);
- }
-
- gtk_widget_size_allocate (child, &child_allocation);
- }
-}
-
-static void
-gtk_handle_box_draw_ghost (GtkHandleBox *hb,
- cairo_t *cr)
-{
- GtkWidget *widget = GTK_WIDGET (hb);
- GtkStateFlags state;
- GtkStyleContext *context;
- guint x;
- guint y;
- guint width;
- guint height;
- gint allocation_width;
- gint allocation_height;
- gint handle_position;
-
- handle_position = effective_handle_position (hb);
- allocation_width = gtk_widget_get_allocated_width (widget);
- allocation_height = gtk_widget_get_allocated_height (widget);
-
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- {
- x = handle_position == GTK_POS_LEFT ? 0 : allocation_width - DRAG_HANDLE_SIZE;
- y = 0;
- width = DRAG_HANDLE_SIZE;
- height = allocation_height;
- }
- else
- {
- x = 0;
- y = handle_position == GTK_POS_TOP ? 0 : allocation_height - DRAG_HANDLE_SIZE;
- width = allocation_width;
- height = DRAG_HANDLE_SIZE;
- }
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
- gtk_style_context_save (context);
- gtk_style_context_set_state (context, state);
-
- gtk_render_background (context, cr, x, y, width, height);
- gtk_render_frame (context, cr, x, y, width, height);
-
- if (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT)
- gtk_render_line (context, cr,
- handle_position == GTK_POS_LEFT ? DRAG_HANDLE_SIZE : 0,
- allocation_height / 2,
- handle_position == GTK_POS_LEFT ? allocation_width : allocation_width - DRAG_HANDLE_SIZE,
- allocation_height / 2);
- else
- gtk_render_line (context, cr,
- allocation_width / 2,
- handle_position == GTK_POS_TOP ? DRAG_HANDLE_SIZE : 0,
- allocation_width / 2,
- handle_position == GTK_POS_TOP ? allocation_height : allocation_height - DRAG_HANDLE_SIZE);
-
- gtk_style_context_restore (context);
-}
-
-/**
- * gtk_handle_box_set_shadow_type:
- * @handle_box: a #GtkHandleBox
- * @type: the shadow type.
- *
- * Sets the type of shadow to be drawn around the border
- * of the handle box.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- */
-void
-gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box,
- GtkShadowType type)
-{
- GtkHandleBoxPrivate *priv;
-
- g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
-
- priv = handle_box->priv;
-
- if ((GtkShadowType) priv->shadow_type != type)
- {
- priv->shadow_type = type;
- g_object_notify (G_OBJECT (handle_box), "shadow-type");
- gtk_widget_queue_resize (GTK_WIDGET (handle_box));
- }
-}
-
-/**
- * gtk_handle_box_get_shadow_type:
- * @handle_box: a #GtkHandleBox
- *
- * Gets the type of shadow drawn around the handle box. See
- * gtk_handle_box_set_shadow_type().
- *
- * Return value: the type of shadow currently drawn around the handle box.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- **/
-GtkShadowType
-gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box)
-{
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), GTK_SHADOW_ETCHED_OUT);
-
- return handle_box->priv->shadow_type;
-}
-
-/**
- * gtk_handle_box_set_handle_position:
- * @handle_box: a #GtkHandleBox
- * @position: the side of the handlebox where the handle should be drawn.
- *
- * Sets the side of the handlebox where the handle is drawn.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- */
-void
-gtk_handle_box_set_handle_position (GtkHandleBox *handle_box,
- GtkPositionType position)
-{
- GtkHandleBoxPrivate *priv;
-
- g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
-
- priv = handle_box->priv;
-
- if ((GtkPositionType) priv->handle_position != position)
- {
- priv->handle_position = position;
- g_object_notify (G_OBJECT (handle_box), "handle-position");
- gtk_widget_queue_resize (GTK_WIDGET (handle_box));
- }
-}
-
-/**
- * gtk_handle_box_get_handle_position:
- * @handle_box: a #GtkHandleBox
- *
- * Gets the handle position of the handle box. See
- * gtk_handle_box_set_handle_position().
- *
- * Return value: the current handle position.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- **/
-GtkPositionType
-gtk_handle_box_get_handle_position (GtkHandleBox *handle_box)
-{
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), GTK_POS_LEFT);
-
- return handle_box->priv->handle_position;
-}
-
-/**
- * gtk_handle_box_set_snap_edge:
- * @handle_box: a #GtkHandleBox
- * @edge: the snap edge, or -1 to unset the value; in which
- * case GTK+ will try to guess an appropriate value
- * in the future.
- *
- * Sets the snap edge of a handlebox. The snap edge is
- * the edge of the detached child that must be aligned
- * with the corresponding edge of the "ghost" left
- * behind when the child was detached to reattach
- * the torn-off window. Usually, the snap edge should
- * be chosen so that it stays in the same place on
- * the screen when the handlebox is torn off.
- *
- * If the snap edge is not set, then an appropriate value
- * will be guessed from the handle position. If the
- * handle position is %GTK_POS_RIGHT or %GTK_POS_LEFT,
- * then the snap edge will be %GTK_POS_TOP, otherwise
- * it will be %GTK_POS_LEFT.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- */
-void
-gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box,
- GtkPositionType edge)
-{
- GtkHandleBoxPrivate *priv;
-
- g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
-
- priv = handle_box->priv;
-
- if (priv->snap_edge != edge)
- {
- priv->snap_edge = edge;
-
- g_object_freeze_notify (G_OBJECT (handle_box));
- g_object_notify (G_OBJECT (handle_box), "snap-edge");
- g_object_notify (G_OBJECT (handle_box), "snap-edge-set");
- g_object_thaw_notify (G_OBJECT (handle_box));
- }
-}
-
-/**
- * gtk_handle_box_get_snap_edge:
- * @handle_box: a #GtkHandleBox
- *
- * Gets the edge used for determining reattachment of the handle box.
- * See gtk_handle_box_set_snap_edge().
- *
- * Return value: the edge used for determining reattachment, or
- * (GtkPositionType)-1 if this is determined (as per default)
- * from the handle position.
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- **/
-GtkPositionType
-gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box)
-{
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), (GtkPositionType)-1);
-
- return handle_box->priv->snap_edge;
-}
-
-/**
- * gtk_handle_box_get_child_detached:
- * @handle_box: a #GtkHandleBox
- *
- * Whether the handlebox's child is currently detached.
- *
- * Return value: %TRUE if the child is currently detached, otherwise %FALSE
- *
- * Since: 2.14
- *
- * Deprecated: 3.4: #GtkHandleBox has been deprecated.
- **/
-gboolean
-gtk_handle_box_get_child_detached (GtkHandleBox *handle_box)
-{
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), FALSE);
-
- return handle_box->priv->child_detached;
-}
-
-static void
-gtk_handle_box_paint (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkBin *bin = GTK_BIN (widget);
- GtkStyleContext *context;
- GtkStateFlags state;
- GtkWidget *child;
- gint width, height;
- GdkRectangle rect;
- gint handle_position;
-
- handle_position = effective_handle_position (hb);
-
- width = gdk_window_get_width (priv->bin_window);
- height = gdk_window_get_height (priv->bin_window);
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
- gtk_style_context_save (context);
- gtk_style_context_set_state (context, state);
-
- gtk_render_background (context, cr, 0, 0, width, height);
- gtk_render_frame (context, cr, 0, 0, width, height);
-
- switch (handle_position)
- {
- case GTK_POS_LEFT:
- rect.x = 0;
- rect.y = 0;
- rect.width = DRAG_HANDLE_SIZE;
- rect.height = height;
- break;
- case GTK_POS_RIGHT:
- rect.x = width - DRAG_HANDLE_SIZE;
- rect.y = 0;
- rect.width = DRAG_HANDLE_SIZE;
- rect.height = height;
- break;
- case GTK_POS_TOP:
- rect.x = 0;
- rect.y = 0;
- rect.width = width;
- rect.height = DRAG_HANDLE_SIZE;
- break;
- case GTK_POS_BOTTOM:
- rect.x = 0;
- rect.y = height - DRAG_HANDLE_SIZE;
- rect.width = width;
- rect.height = DRAG_HANDLE_SIZE;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- gtk_render_handle (context, cr,
- rect.x, rect.y, rect.width, rect.height);
-
- child = gtk_bin_get_child (bin);
- if (child != NULL && gtk_widget_get_visible (child))
- GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->draw (widget, cr);
-
- gtk_style_context_restore (context);
-}
-
-static gboolean
-gtk_handle_box_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
-
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- {
- if (priv->child_detached)
- gtk_handle_box_draw_ghost (hb, cr);
- }
- else if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- gtk_handle_box_paint (widget, cr);
-
- return FALSE;
-}
-
-static GtkWidget *
-gtk_handle_box_get_invisible (void)
-{
- static GtkWidget *handle_box_invisible = NULL;
-
- if (!handle_box_invisible)
- {
- handle_box_invisible = gtk_invisible_new ();
- gtk_widget_show (handle_box_invisible);
- }
-
- return handle_box_invisible;
-}
-
-static gboolean
-gtk_handle_box_grab_event (GtkWidget *widget,
- GdkEvent *event,
- GtkHandleBox *hb)
-{
- GtkHandleBoxPrivate *priv = hb->priv;
-
- switch (event->type)
- {
- case GDK_BUTTON_RELEASE:
- if (priv->in_drag) /* sanity check */
- {
- gtk_handle_box_end_drag (hb, event->button.time);
- return TRUE;
- }
- break;
-
- case GDK_MOTION_NOTIFY:
- return gtk_handle_box_motion (GTK_WIDGET (hb), (GdkEventMotion *)event);
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static gboolean
-gtk_handle_box_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- gboolean event_handled;
- GdkCursor *fleur;
- gint handle_position;
-
- handle_position = effective_handle_position (hb);
-
- event_handled = FALSE;
- if ((event->button == 1) &&
- (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS))
- {
- GtkWidget *child;
- gboolean in_handle;
-
- if (event->window != priv->bin_window)
- return FALSE;
-
- child = gtk_bin_get_child (GTK_BIN (hb));
-
- if (child)
- {
- GtkAllocation child_allocation;
- guint border_width;
-
- gtk_widget_get_allocation (child, &child_allocation);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (hb));
-
- switch (handle_position)
- {
- case GTK_POS_LEFT:
- in_handle = event->x < DRAG_HANDLE_SIZE;
- break;
- case GTK_POS_TOP:
- in_handle = event->y < DRAG_HANDLE_SIZE;
- break;
- case GTK_POS_RIGHT:
- in_handle = event->x > 2 * border_width + child_allocation.width;
- break;
- case GTK_POS_BOTTOM:
- in_handle = event->y > 2 * border_width + child_allocation.height;
- break;
- default:
- in_handle = FALSE;
- break;
- }
- }
- else
- {
- in_handle = FALSE;
- event_handled = TRUE;
- }
-
- if (in_handle)
- {
- if (event->type == GDK_BUTTON_PRESS) /* Start a drag */
- {
- GtkWidget *invisible = gtk_handle_box_get_invisible ();
- GdkWindow *window;
- gint root_x, root_y;
-
- gtk_invisible_set_screen (GTK_INVISIBLE (invisible),
- gtk_widget_get_screen (GTK_WIDGET (hb)));
- gdk_window_get_origin (priv->bin_window, &root_x, &root_y);
-
- priv->orig_x = event->x_root;
- priv->orig_y = event->y_root;
-
- priv->float_allocation.x = root_x - event->x_root;
- priv->float_allocation.y = root_y - event->y_root;
- priv->float_allocation.width = gdk_window_get_width (priv->bin_window);
- priv->float_allocation.height = gdk_window_get_height (priv->bin_window);
-
- window = gtk_widget_get_window (widget);
- if (gdk_window_is_viewable (window))
- {
- gdk_window_get_origin (window, &root_x, &root_y);
-
- priv->attach_allocation.x = root_x;
- priv->attach_allocation.y = root_y;
- priv->attach_allocation.width = gdk_window_get_width (window);
- priv->attach_allocation.height = gdk_window_get_height (window);
- }
- else
- {
- priv->attach_allocation.x = -1;
- priv->attach_allocation.y = -1;
- priv->attach_allocation.width = 0;
- priv->attach_allocation.height = 0;
- }
- priv->in_drag = TRUE;
- priv->grab_device = event->device;
- fleur = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
- GDK_FLEUR);
- if (gdk_device_grab (event->device,
- gtk_widget_get_window (invisible),
- GDK_OWNERSHIP_WINDOW,
- FALSE,
- (GDK_BUTTON1_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_RELEASE_MASK),
- fleur,
- event->time) != GDK_GRAB_SUCCESS)
- {
- priv->in_drag = FALSE;
- priv->grab_device = NULL;
- }
- else
- {
- gtk_device_grab_add (invisible, priv->grab_device, TRUE);
- g_signal_connect (invisible, "event",
- G_CALLBACK (gtk_handle_box_grab_event), hb);
- }
-
- g_object_unref (fleur);
- event_handled = TRUE;
- }
- else if (priv->child_detached) /* Double click */
- {
- gtk_handle_box_reattach (hb);
- }
- }
- }
-
- return event_handled;
-}
-
-static gboolean
-gtk_handle_box_motion (GtkWidget *widget,
- GdkEventMotion *event)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkWidget *child;
- gint new_x, new_y;
- gint snap_edge;
- gboolean is_snapped = FALSE;
- gint handle_position;
- GdkGeometry geometry;
- GdkScreen *screen, *pointer_screen;
-
- if (!priv->in_drag)
- return FALSE;
- handle_position = effective_handle_position (hb);
-
- /* Calculate the attachment point on the float, if the float
- * were detached
- */
- new_x = 0;
- new_y = 0;
- screen = gtk_widget_get_screen (widget);
- gdk_device_get_position (event->device,
- &pointer_screen,
- &new_x, &new_y);
- if (pointer_screen != screen)
- {
- new_x = priv->orig_x;
- new_y = priv->orig_y;
- }
-
- new_x += priv->float_allocation.x;
- new_y += priv->float_allocation.y;
-
- snap_edge = priv->snap_edge;
- if (snap_edge == -1)
- snap_edge = (handle_position == GTK_POS_LEFT ||
- handle_position == GTK_POS_RIGHT) ?
- GTK_POS_TOP : GTK_POS_LEFT;
-
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- switch (snap_edge)
- {
- case GTK_POS_LEFT:
- snap_edge = GTK_POS_RIGHT;
- break;
- case GTK_POS_RIGHT:
- snap_edge = GTK_POS_LEFT;
- break;
- default:
- break;
- }
-
- /* First, check if the snapped edge is aligned
- */
- switch (snap_edge)
- {
- case GTK_POS_TOP:
- is_snapped = abs (priv->attach_allocation.y - new_y) < TOLERANCE;
- break;
- case GTK_POS_BOTTOM:
- is_snapped = abs (priv->attach_allocation.y + (gint)priv->attach_allocation.height -
- new_y - (gint)priv->float_allocation.height) < TOLERANCE;
- break;
- case GTK_POS_LEFT:
- is_snapped = abs (priv->attach_allocation.x - new_x) < TOLERANCE;
- break;
- case GTK_POS_RIGHT:
- is_snapped = abs (priv->attach_allocation.x + (gint)priv->attach_allocation.width -
- new_x - (gint)priv->float_allocation.width) < TOLERANCE;
- break;
- }
-
- /* Next, check if coordinates in the other direction are sufficiently
- * aligned
- */
- if (is_snapped)
- {
- gint float_pos1 = 0; /* Initialize to suppress warnings */
- gint float_pos2 = 0;
- gint attach_pos1 = 0;
- gint attach_pos2 = 0;
-
- switch (snap_edge)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- attach_pos1 = priv->attach_allocation.x;
- attach_pos2 = priv->attach_allocation.x + priv->attach_allocation.width;
- float_pos1 = new_x;
- float_pos2 = new_x + priv->float_allocation.width;
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- attach_pos1 = priv->attach_allocation.y;
- attach_pos2 = priv->attach_allocation.y + priv->attach_allocation.height;
- float_pos1 = new_y;
- float_pos2 = new_y + priv->float_allocation.height;
- break;
- }
-
- is_snapped = ((attach_pos1 - TOLERANCE < float_pos1) &&
- (attach_pos2 + TOLERANCE > float_pos2)) ||
- ((float_pos1 - TOLERANCE < attach_pos1) &&
- (float_pos2 + TOLERANCE > attach_pos2));
- }
-
- child = gtk_bin_get_child (GTK_BIN (hb));
-
- if (is_snapped)
- {
- if (priv->child_detached)
- {
- priv->child_detached = FALSE;
- gdk_window_hide (priv->float_window);
- gdk_window_reparent (priv->bin_window, gtk_widget_get_window (widget), 0, 0);
- priv->float_window_mapped = FALSE;
- g_signal_emit (hb,
- handle_box_signals[SIGNAL_CHILD_ATTACHED],
- 0,
- child);
-
- gtk_widget_queue_resize (widget);
- }
- }
- else
- {
- gint width, height;
-
- width = gdk_window_get_width (priv->float_window);
- height = gdk_window_get_height (priv->float_window);
-
- switch (handle_position)
- {
- case GTK_POS_LEFT:
- new_y += ((gint)priv->float_allocation.height - height) / 2;
- break;
- case GTK_POS_RIGHT:
- new_x += (gint)priv->float_allocation.width - width;
- new_y += ((gint)priv->float_allocation.height - height) / 2;
- break;
- case GTK_POS_TOP:
- new_x += ((gint)priv->float_allocation.width - width) / 2;
- break;
- case GTK_POS_BOTTOM:
- new_x += ((gint)priv->float_allocation.width - width) / 2;
- new_y += (gint)priv->float_allocation.height - height;
- break;
- }
-
- if (priv->child_detached)
- {
- gdk_window_move (priv->float_window, new_x, new_y);
- gdk_window_raise (priv->float_window);
- }
- else
- {
- guint border_width;
- GtkRequisition child_requisition;
-
- priv->child_detached = TRUE;
-
- if (child)
- {
- gtk_widget_get_preferred_size (child, &child_requisition, NULL);
- }
- else
- {
- child_requisition.width = 0;
- child_requisition.height = 0;
- }
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (hb));
- width = child_requisition.width + 2 * border_width;
- height = child_requisition.height + 2 * border_width;
-
- if (handle_position == GTK_POS_LEFT || handle_position == GTK_POS_RIGHT)
- width += DRAG_HANDLE_SIZE;
- else
- height += DRAG_HANDLE_SIZE;
-
- gdk_window_move_resize (priv->float_window, new_x, new_y, width, height);
- gdk_window_reparent (priv->bin_window, priv->float_window, 0, 0);
- gdk_window_set_geometry_hints (priv->float_window, &geometry, GDK_HINT_POS);
- gdk_window_show (priv->float_window);
- priv->float_window_mapped = TRUE;
-#if 0
- /* this extra move is necessary if we use decorations, or our
- * window manager insists on decorations.
- */
- gdk_display_sync (gtk_widget_get_display (widget));
- gdk_window_move (priv->float_window, new_x, new_y);
- gdk_display_sync (gtk_widget_get_display (widget));
-#endif /* 0 */
- g_signal_emit (hb,
- handle_box_signals[SIGNAL_CHILD_DETACHED],
- 0,
- child);
-
- gtk_widget_queue_resize (widget);
- }
- }
-
- return TRUE;
-}
-
-static void
-gtk_handle_box_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkHandleBoxPrivate *priv = GTK_HANDLE_BOX (container)->priv;
-
- gtk_widget_set_parent_window (widget, priv->bin_window);
- GTK_CONTAINER_CLASS (gtk_handle_box_parent_class)->add (container, widget);
-}
-
-static void
-gtk_handle_box_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GTK_CONTAINER_CLASS (gtk_handle_box_parent_class)->remove (container, widget);
-
- gtk_handle_box_reattach (GTK_HANDLE_BOX (container));
-}
-
-static gint
-gtk_handle_box_delete_event (GtkWidget *widget,
- GdkEventAny *event)
-{
- GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
- GtkHandleBoxPrivate *priv = hb->priv;
-
- if (event->window == priv->float_window)
- {
- gtk_handle_box_reattach (hb);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-gtk_handle_box_reattach (GtkHandleBox *hb)
-{
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkWidget *child;
- GtkWidget *widget = GTK_WIDGET (hb);
-
- if (priv->child_detached)
- {
- priv->child_detached = FALSE;
- if (gtk_widget_get_realized (widget))
- {
- gdk_window_hide (priv->float_window);
- gdk_window_reparent (priv->bin_window, gtk_widget_get_window (widget),
- 0, 0);
-
- child = gtk_bin_get_child (GTK_BIN (hb));
- if (child)
- g_signal_emit (hb,
- handle_box_signals[SIGNAL_CHILD_ATTACHED],
- 0,
- child);
-
- }
- priv->float_window_mapped = FALSE;
- }
- if (priv->in_drag)
- gtk_handle_box_end_drag (hb, GDK_CURRENT_TIME);
-
- gtk_widget_queue_resize (GTK_WIDGET (hb));
-}
-
-static void
-gtk_handle_box_end_drag (GtkHandleBox *hb,
- guint32 time)
-{
- GtkHandleBoxPrivate *priv = hb->priv;
- GtkWidget *invisible = gtk_handle_box_get_invisible ();
-
- priv->in_drag = FALSE;
-
- gtk_device_grab_remove (invisible, priv->grab_device);
- gdk_device_ungrab (priv->grab_device, time);
- g_signal_handlers_disconnect_by_func (invisible,
- G_CALLBACK (gtk_handle_box_grab_event),
- hb);
-
- priv->grab_device = NULL;
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-/* The GtkHandleBox is to allow widgets to be dragged in and out of
- * their parents.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HANDLE_BOX_H__
-#define __GTK_HANDLE_BOX_H__
-
-
-#include <gtk/gtkbin.h>
-
-
-G_BEGIN_DECLS
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define GTK_TYPE_HANDLE_BOX (gtk_handle_box_get_type ())
-#define GTK_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBox))
-#define GTK_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass))
-#define GTK_IS_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HANDLE_BOX))
-#define GTK_IS_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HANDLE_BOX))
-#define GTK_HANDLE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass))
-
-typedef struct _GtkHandleBox GtkHandleBox;
-typedef struct _GtkHandleBoxPrivate GtkHandleBoxPrivate;
-typedef struct _GtkHandleBoxClass GtkHandleBoxClass;
-
-struct _GtkHandleBox
-{
- GtkBin bin;
-
- /*< private >*/
- GtkHandleBoxPrivate *priv;
-};
-
-struct _GtkHandleBoxClass
-{
- GtkBinClass parent_class;
-
- void (*child_attached) (GtkHandleBox *handle_box,
- GtkWidget *child);
- void (*child_detached) (GtkHandleBox *handle_box,
- GtkWidget *child);
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-
-GType gtk_handle_box_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED
-GtkWidget* gtk_handle_box_new (void);
-GDK_DEPRECATED
-void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box,
- GtkShadowType type);
-GDK_DEPRECATED
-GtkShadowType gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box);
-GDK_DEPRECATED
-void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box,
- GtkPositionType position);
-GDK_DEPRECATED
-GtkPositionType gtk_handle_box_get_handle_position(GtkHandleBox *handle_box);
-GDK_DEPRECATED
-void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box,
- GtkPositionType edge);
-GDK_DEPRECATED
-GtkPositionType gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box);
-GDK_DEPRECATED
-gboolean gtk_handle_box_get_child_detached (GtkHandleBox *handle_box);
-
-#endif /* GTK_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __GTK_HANDLE_BOX_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkhbbox.h"
-#include "gtkorientable.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtkhbbox
- * @Short_description: A container for arranging buttons horizontally
- * @Title: GtkHButtonBox
- * @See_also: #GtkBox, #GtkButtonBox, #GtkVButtonBox
- *
- * A button box should be used to provide a consistent layout of buttons
- * throughout your application. The layout/spacing can be altered by the
- * programmer, or if desired, by the user to alter the 'feel' of a
- * program to a small degree.
- *
- * A #GtkHButtonBox is created with gtk_hbutton_box_new(). Buttons are
- * packed into a button box the same way widgets are added to any other
- * container, using gtk_container_add(). You can also use
- * gtk_box_pack_start() or gtk_box_pack_end(), but for button boxes both
- * these functions work just like gtk_container_add(), ie., they pack the
- * button in a way that depends on the current layout style and on
- * whether the button has had gtk_button_box_set_child_secondary() called
- * on it.
- *
- * The spacing between buttons can be set with gtk_box_set_spacing(). The
- * arrangement and layout of the buttons can be changed with
- * gtk_button_box_set_layout().
- *
- * GtkHButtonBox has been deprecated, use #GtkButtonBox instead.
- */
-
-
-G_DEFINE_TYPE (GtkHButtonBox, gtk_hbutton_box, GTK_TYPE_BUTTON_BOX)
-
-static void
-gtk_hbutton_box_class_init (GtkHButtonBoxClass *class)
-{
-}
-
-static void
-gtk_hbutton_box_init (GtkHButtonBox *hbutton_box)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (hbutton_box),
- GTK_ORIENTATION_HORIZONTAL);
-}
-
-/**
- * gtk_hbutton_box_new:
- *
- * Creates a new horizontal button box.
- *
- * Returns: a new button box #GtkWidget.
- *
- * Deprecated: 3.2: Use gtk_button_box_new() with %GTK_ORIENTATION_HORIZONTAL instead
- */
-GtkWidget *
-gtk_hbutton_box_new (void)
-{
- return g_object_new (GTK_TYPE_HBUTTON_BOX, NULL);
-}
-
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HBUTTON_BOX_H__
-#define __GTK_HBUTTON_BOX_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkbbox.h>
-
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_HBUTTON_BOX (gtk_hbutton_box_get_type ())
-#define GTK_HBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HBUTTON_BOX, GtkHButtonBox))
-#define GTK_HBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HBUTTON_BOX, GtkHButtonBoxClass))
-#define GTK_IS_HBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HBUTTON_BOX))
-#define GTK_IS_HBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HBUTTON_BOX))
-#define GTK_HBUTTON_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HBUTTON_BOX, GtkHButtonBoxClass))
-
-
-typedef struct _GtkHButtonBox GtkHButtonBox;
-typedef struct _GtkHButtonBoxClass GtkHButtonBoxClass;
-
-struct _GtkHButtonBox
-{
- GtkButtonBox button_box;
-};
-
-struct _GtkHButtonBoxClass
-{
- GtkButtonBoxClass parent_class;
-};
-
-
-GType gtk_hbutton_box_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_button_box_new)
-GtkWidget* gtk_hbutton_box_new (void);
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_HBUTTON_BOX_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkboxprivate.h"
-#include "gtkorientable.h"
-
-#include "gtkhbox.h"
-
-
-/**
- * SECTION:gtkhbox
- * @Short_description: A horizontal container box
- * @Title: GtkHBox
- * @See_also: #GtkVBox
- *
- * #GtkHBox is a container that organizes child widgets into a single row.
- *
- * Use the #GtkBox packing interface to determine the arrangement,
- * spacing, width, and alignment of #GtkHBox children.
- *
- * All children are allocated the same height.
- *
- * GtkHBox has been deprecated. You can use #GtkBox instead, which is a
- * very quick and easy change. If you have derived your own classes from
- * GtkHBox, you can simply change the inheritance to derive directly
- * from #GtkBox. No further changes are needed, since the default
- * value of the #GtkOrientable::orientation property is
- * %GTK_ORIENTATION_HORIZONTAL.
- * If you want your code to be future-proof, the recommendation is to
- * switch to #GtkGrid, since #GtkBox is going to be deprecated in favor
- * of the more flexible grid widget eventually. For more information
- * about migrating to #GtkGrid, see <xref linkend="gtk-migrating-GtkGrid"/>
- */
-
-
-G_DEFINE_TYPE (GtkHBox, gtk_hbox, GTK_TYPE_BOX)
-
-static void
-gtk_hbox_class_init (GtkHBoxClass *class)
-{
-}
-
-static void
-gtk_hbox_init (GtkHBox *hbox)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (hbox),
- GTK_ORIENTATION_HORIZONTAL);
-
- _gtk_box_set_old_defaults (GTK_BOX (hbox));
-}
-
-/**
- * gtk_hbox_new:
- * @homogeneous: %TRUE if all children are to be given equal space allotments.
- * @spacing: the number of pixels to place by default between children.
- *
- * Creates a new #GtkHBox.
- *
- * Returns: a new #GtkHBox.
- *
- * Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_HORIZONTAL instead,
- * wich is a very quick and easy change. But the recommendation is to switch to
- * #GtkGrid, since #GtkBox is going to go away eventually.
- * See <xref linkend="gtk-migrating-GtkGrid"/>.
- */
-GtkWidget *
-gtk_hbox_new (gboolean homogeneous,
- gint spacing)
-{
- return g_object_new (GTK_TYPE_HBOX,
- "spacing", spacing,
- "homogeneous", homogeneous ? TRUE : FALSE,
- NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HBOX_H__
-#define __GTK_HBOX_H__
-
-
-#include <gtk/gtkbox.h>
-
-
-G_BEGIN_DECLS
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define GTK_TYPE_HBOX (gtk_hbox_get_type ())
-#define GTK_HBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HBOX, GtkHBox))
-#define GTK_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HBOX, GtkHBoxClass))
-#define GTK_IS_HBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HBOX))
-#define GTK_IS_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HBOX))
-#define GTK_HBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HBOX, GtkHBoxClass))
-
-
-typedef struct _GtkHBox GtkHBox;
-typedef struct _GtkHBoxClass GtkHBoxClass;
-
-struct _GtkHBox
-{
- GtkBox box;
-};
-
-struct _GtkHBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-GType gtk_hbox_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_box_new)
-GtkWidget * gtk_hbox_new (gboolean homogeneous,
- gint spacing);
-
-#endif
-
-G_END_DECLS
-
-#endif /* __GTK_HBOX_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkhpaned.h"
-#include "gtkorientable.h"
-
-
-/**
- * SECTION:gtkhpaned
- * @Short_description: A container with two panes arranged horizontally
- * @Title: GtkHPaned
- *
- * The HPaned widget is a container widget with two
- * children arranged horizontally. The division between
- * the two panes is adjustable by the user by dragging
- * a handle. See #GtkPaned for details.
- *
- * GtkHPaned has been deprecated, use #GtkPaned instead.
- */
-
-
-G_DEFINE_TYPE (GtkHPaned, gtk_hpaned, GTK_TYPE_PANED)
-
-static void
-gtk_hpaned_class_init (GtkHPanedClass *class)
-{
-}
-
-static void
-gtk_hpaned_init (GtkHPaned *hpaned)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (hpaned),
- GTK_ORIENTATION_HORIZONTAL);
-}
-
-/**
- * gtk_hpaned_new:
- *
- * Create a new #GtkHPaned
- *
- * Returns: the new #GtkHPaned
- *
- * Deprecated: 3.2: Use gtk_paned_new() with %GTK_ORIENTATION_HORIZONTAL instead
- */
-GtkWidget *
-gtk_hpaned_new (void)
-{
- return g_object_new (GTK_TYPE_HPANED, NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HPANED_H__
-#define __GTK_HPANED_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkpaned.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_HPANED (gtk_hpaned_get_type ())
-#define GTK_HPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HPANED, GtkHPaned))
-#define GTK_HPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HPANED, GtkHPanedClass))
-#define GTK_IS_HPANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HPANED))
-#define GTK_IS_HPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HPANED))
-#define GTK_HPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HPANED, GtkHPanedClass))
-
-
-typedef struct _GtkHPaned GtkHPaned;
-typedef struct _GtkHPanedClass GtkHPanedClass;
-
-struct _GtkHPaned
-{
- GtkPaned paned;
-};
-
-struct _GtkHPanedClass
-{
- GtkPanedClass parent_class;
-};
-
-
-GType gtk_hpaned_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_paned_new)
-GtkWidget * gtk_hpaned_new (void);
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_HPANED_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2001 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include <math.h>
-#include <stdlib.h>
-
-#include "gtkhscale.h"
-#include "gtkorientable.h"
-
-
-/**
- * SECTION:gtkhscale
- * @Short_description: A horizontal slider widget for selecting a value from a range
- * @Title: GtkHScale
- *
- * The #GtkHScale widget is used to allow the user to select a value using
- * a horizontal slider. To create one, use gtk_hscale_new_with_range().
- *
- * The position to show the current value, and the number of decimal places
- * shown can be set using the parent #GtkScale class's functions.
- *
- * GtkHScale has been deprecated, use #GtkScale instead.
- */
-
-
-G_DEFINE_TYPE (GtkHScale, gtk_hscale, GTK_TYPE_SCALE)
-
-static void
-gtk_hscale_class_init (GtkHScaleClass *class)
-{
- GtkRangeClass *range_class = GTK_RANGE_CLASS (class);
-
- range_class->slider_detail = "hscale";
-}
-
-static void
-gtk_hscale_init (GtkHScale *hscale)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (hscale),
- GTK_ORIENTATION_HORIZONTAL);
-}
-
-/**
- * gtk_hscale_new:
- * @adjustment: the #GtkAdjustment which sets the range of the scale.
- *
- * Creates a new #GtkHScale.
- *
- * Returns: a new #GtkHScale.
- *
- * Deprecated: 3.2: Use gtk_scale_new() with %GTK_ORIENTATION_HORIZONTAL instead
- */
-GtkWidget *
-gtk_hscale_new (GtkAdjustment *adjustment)
-{
- g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
- NULL);
-
- return g_object_new (GTK_TYPE_HSCALE,
- "adjustment", adjustment,
- NULL);
-}
-
-/**
- * gtk_hscale_new_with_range:
- * @min: minimum value
- * @max: maximum value
- * @step: step increment (tick size) used with keyboard shortcuts
- *
- * Creates a new horizontal scale widget that lets the user input a
- * number between @min and @max (including @min and @max) with the
- * increment @step. @step must be nonzero; it's the distance the
- * slider moves when using the arrow keys to adjust the scale value.
- *
- * Note that the way in which the precision is derived works best if @step
- * is a power of ten. If the resulting precision is not suitable for your
- * needs, use gtk_scale_set_digits() to correct it.
- *
- * Return value: a new #GtkHScale
- *
- * Deprecated: 3.2: Use gtk_scale_new_with_range() with %GTK_ORIENTATION_HORIZONTAL instead
- **/
-GtkWidget *
-gtk_hscale_new_with_range (gdouble min,
- gdouble max,
- gdouble step)
-{
- GtkAdjustment *adj;
- GtkScale *scale;
- gint digits;
-
- g_return_val_if_fail (min < max, NULL);
- g_return_val_if_fail (step != 0.0, NULL);
-
- adj = gtk_adjustment_new (min, min, max, step, 10 * step, 0);
-
- if (fabs (step) >= 1.0 || step == 0.0)
- {
- digits = 0;
- }
- else
- {
- digits = abs ((gint) floor (log10 (fabs (step))));
- if (digits > 5)
- digits = 5;
- }
-
- scale = g_object_new (GTK_TYPE_HSCALE,
- "adjustment", adj,
- "digits", digits,
- NULL);
-
- return GTK_WIDGET (scale);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HSCALE_H__
-#define __GTK_HSCALE_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkscale.h>
-
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_HSCALE (gtk_hscale_get_type ())
-#define GTK_HSCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSCALE, GtkHScale))
-#define GTK_HSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSCALE, GtkHScaleClass))
-#define GTK_IS_HSCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSCALE))
-#define GTK_IS_HSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSCALE))
-#define GTK_HSCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSCALE, GtkHScaleClass))
-
-
-typedef struct _GtkHScale GtkHScale;
-typedef struct _GtkHScaleClass GtkHScaleClass;
-
-struct _GtkHScale
-{
- GtkScale scale;
-};
-
-struct _GtkHScaleClass
-{
- GtkScaleClass parent_class;
-};
-
-
-GType gtk_hscale_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_scale_new)
-GtkWidget* gtk_hscale_new (GtkAdjustment *adjustment);
-GDK_DEPRECATED_FOR(gtk_scale_new_with_range)
-GtkWidget* gtk_hscale_new_with_range (gdouble min,
- gdouble max,
- gdouble step);
-
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_HSCALE_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 2001 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkscrollbar.h"
-
-#include "gtkhscrollbar.h"
-#include "gtkorientable.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtkhscrollbar
- * @Short_description: A horizontal scrollbar
- * @Title: GtkHScrollbar
- * @See_also: #GtkScrollbar, #GtkScrolledWindow
- *
- * The #GtkHScrollbar widget is a widget arranged horizontally creating a
- * scrollbar. See #GtkScrollbar for details on
- * scrollbars. #GtkAdjustment pointers may be added to handle the
- * adjustment of the scrollbar or it may be left %NULL in which case one
- * will be created for you. See #GtkScrollbar for a description of what the
- * fields in an adjustment represent for a scrollbar.
- *
- * GtkHScrollbar has been deprecated, use #GtkScrollbar instead.
- */
-
-
-G_DEFINE_TYPE (GtkHScrollbar, gtk_hscrollbar, GTK_TYPE_SCROLLBAR)
-
-static void
-gtk_hscrollbar_class_init (GtkHScrollbarClass *class)
-{
- GTK_RANGE_CLASS (class)->stepper_detail = "hscrollbar";
-}
-
-static void
-gtk_hscrollbar_init (GtkHScrollbar *hscrollbar)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (hscrollbar),
- GTK_ORIENTATION_HORIZONTAL);
-}
-
-/**
- * gtk_hscrollbar_new:
- * @adjustment: (allow-none): the #GtkAdjustment to use, or %NULL to create a new adjustment
- *
- * Creates a new horizontal scrollbar.
- *
- * Returns: the new #GtkHScrollbar
- *
- * Deprecated: 3.2: Use gtk_scrollbar_new() with %GTK_ORIENTATION_HORIZONTAL instead
- */
-GtkWidget *
-gtk_hscrollbar_new (GtkAdjustment *adjustment)
-{
- g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
- NULL);
-
- return g_object_new (GTK_TYPE_HSCROLLBAR,
- "adjustment", adjustment,
- NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HSCROLLBAR_H__
-#define __GTK_HSCROLLBAR_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkscrollbar.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GTK_TYPE_HSCROLLBAR (gtk_hscrollbar_get_type ())
-#define GTK_HSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSCROLLBAR, GtkHScrollbar))
-#define GTK_HSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSCROLLBAR, GtkHScrollbarClass))
-#define GTK_IS_HSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSCROLLBAR))
-#define GTK_IS_HSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSCROLLBAR))
-#define GTK_HSCROLLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSCROLLBAR, GtkHScrollbarClass))
-
-
-typedef struct _GtkHScrollbar GtkHScrollbar;
-typedef struct _GtkHScrollbarClass GtkHScrollbarClass;
-
-struct _GtkHScrollbar
-{
- GtkScrollbar scrollbar;
-};
-
-struct _GtkHScrollbarClass
-{
- GtkScrollbarClass parent_class;
-};
-
-
-GType gtk_hscrollbar_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_scrollbar_new)
-GtkWidget* gtk_hscrollbar_new (GtkAdjustment *adjustment);
-
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_HSCROLLBAR_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkhseparator.h"
-#include "gtkorientable.h"
-
-
-/**
- * SECTION:gtkhseparator
- * @Short_description: A horizontal separator
- * @Title: GtkHSeparator
- * @See_also: #GtkSeparator
- *
- * The #GtkHSeparator widget is a horizontal separator, used to group the
- * widgets within a window. It displays a horizontal line with a shadow to
- * make it appear sunken into the interface.
- *
- * <note>
- * The #GtkHSeparator widget is not used as a separator within menus.
- * To create a separator in a menu create an empty #GtkSeparatorMenuItem
- * widget using gtk_separator_menu_item_new() and add it to the menu with
- * gtk_menu_shell_append().
- * </note>
- *
- * GtkHSeparator has been deprecated, use #GtkSeparator instead.
- */
-
-
-G_DEFINE_TYPE (GtkHSeparator, gtk_hseparator, GTK_TYPE_SEPARATOR)
-
-static void
-gtk_hseparator_class_init (GtkHSeparatorClass *class)
-{
-}
-
-static void
-gtk_hseparator_init (GtkHSeparator *hseparator)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (hseparator),
- GTK_ORIENTATION_HORIZONTAL);
-}
-
-/**
- * gtk_hseparator_new:
- *
- * Creates a new #GtkHSeparator.
- *
- * Returns: a new #GtkHSeparator.
- *
- * Deprecated: 3.2: Use gtk_separator_new() with %GTK_ORIENTATION_HORIZONTAL instead
- */
-GtkWidget *
-gtk_hseparator_new (void)
-{
- return g_object_new (GTK_TYPE_HSEPARATOR, NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_HSEPARATOR_H__
-#define __GTK_HSEPARATOR_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkseparator.h>
-
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_HSEPARATOR (gtk_hseparator_get_type ())
-#define GTK_HSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSEPARATOR, GtkHSeparator))
-#define GTK_HSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSEPARATOR, GtkHSeparatorClass))
-#define GTK_IS_HSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSEPARATOR))
-#define GTK_IS_HSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSEPARATOR))
-#define GTK_HSEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSEPARATOR, GtkHSeparatorClass))
-
-
-typedef struct _GtkHSeparator GtkHSeparator;
-typedef struct _GtkHSeparatorClass GtkHSeparatorClass;
-
-struct _GtkHSeparator
-{
- GtkSeparator separator;
-};
-
-struct _GtkHSeparatorClass
-{
- GtkSeparatorClass parent_class;
-};
-
-
-GType gtk_hseparator_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_separator_new)
-GtkWidget* gtk_hseparator_new (void);
-
-
-G_END_DECLS
-
-#endif
-#endif /* __GTK_HSEPARATOR_H__ */
#include "gtkintl.h"
#include "gtktypebuiltins.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
#include "a11y/gtkmenuaccessible.h"
#include "gtkintl.h"
#include "gtktypebuiltins.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
#include "a11y/gtkmenushellaccessible.h"
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include "gtktable.h"
-
-#include "gtktypebuiltins.h"
-#include "gtkprivate.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtktable
- * @Short_description: Pack widgets in regular patterns
- * @Title: GtkTable
- * @See_also: #GtkGrid
- *
- * The #GtkTable functions allow the programmer to arrange widgets in rows and
- * columns, making it easy to align many widgets next to each other,
- * horizontally and vertically.
- *
- * Tables are created with a call to gtk_table_new(), the size of which can
- * later be changed with gtk_table_resize().
- *
- * Widgets can be added to a table using gtk_table_attach() or the more
- * convenient (but slightly less flexible) gtk_table_attach_defaults().
- *
- * To alter the space next to a specific row, use gtk_table_set_row_spacing(),
- * and for a column, gtk_table_set_col_spacing().
- * The gaps between <emphasis>all</emphasis> rows or columns can be changed by
- * calling gtk_table_set_row_spacings() or gtk_table_set_col_spacings()
- * respectively. Note that spacing is added <emphasis>between</emphasis> the
- * children, while padding added by gtk_table_attach() is added <emphasis>on
- * either side</emphasis> of the widget it belongs to.
- *
- * gtk_table_set_homogeneous(), can be used to set whether all cells in the
- * table will resize themselves to the size of the largest widget in the table.
- *
- * <note>
- * #GtkTable has been deprecated. Use #GtkGrid instead. It provides the same
- * capabilities as GtkTable for arranging widgets in a rectangular grid, but
- * does support height-for-width geometry management.
- * </note>
- */
-
-
-struct _GtkTablePrivate
-{
- GtkTableRowCol *cols;
- GtkTableRowCol *rows;
-
- GList *children;
-
- guint16 column_spacing;
- guint16 ncols;
- guint16 nrows;
- guint16 row_spacing;
-
- guint homogeneous : 1;
-};
-
-enum
-{
- PROP_0,
- PROP_N_ROWS,
- PROP_N_COLUMNS,
- PROP_COLUMN_SPACING,
- PROP_ROW_SPACING,
- PROP_HOMOGENEOUS
-};
-
-enum
-{
- CHILD_PROP_0,
- CHILD_PROP_LEFT_ATTACH,
- CHILD_PROP_RIGHT_ATTACH,
- CHILD_PROP_TOP_ATTACH,
- CHILD_PROP_BOTTOM_ATTACH,
- CHILD_PROP_X_OPTIONS,
- CHILD_PROP_Y_OPTIONS,
- CHILD_PROP_X_PADDING,
- CHILD_PROP_Y_PADDING
-};
-
-
-static void gtk_table_finalize (GObject *object);
-static void gtk_table_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_table_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_table_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_table_compute_expand (GtkWidget *widget,
- gboolean *hexpand,
- gboolean *vexpand);
-static void gtk_table_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_table_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_table_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-static void gtk_table_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void gtk_table_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_table_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_table_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static GType gtk_table_child_type (GtkContainer *container);
-
-
-static void gtk_table_size_request_init (GtkTable *table);
-static void gtk_table_size_request_pass1 (GtkTable *table);
-static void gtk_table_size_request_pass2 (GtkTable *table);
-static void gtk_table_size_request_pass3 (GtkTable *table);
-
-static void gtk_table_size_allocate_init (GtkTable *table);
-static void gtk_table_size_allocate_pass1 (GtkTable *table);
-static void gtk_table_size_allocate_pass2 (GtkTable *table);
-
-
-G_DEFINE_TYPE (GtkTable, gtk_table, GTK_TYPE_CONTAINER)
-
-static void
-gtk_table_class_init (GtkTableClass *class)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
-
- gobject_class->finalize = gtk_table_finalize;
-
- gobject_class->get_property = gtk_table_get_property;
- gobject_class->set_property = gtk_table_set_property;
-
- widget_class->get_preferred_width = gtk_table_get_preferred_width;
- widget_class->get_preferred_height = gtk_table_get_preferred_height;
- widget_class->size_allocate = gtk_table_size_allocate;
- widget_class->compute_expand = gtk_table_compute_expand;
-
- container_class->add = gtk_table_add;
- container_class->remove = gtk_table_remove;
- container_class->forall = gtk_table_forall;
- container_class->child_type = gtk_table_child_type;
- container_class->set_child_property = gtk_table_set_child_property;
- container_class->get_child_property = gtk_table_get_child_property;
- gtk_container_class_handle_border_width (container_class);
-
- g_object_class_install_property (gobject_class,
- PROP_N_ROWS,
- g_param_spec_uint ("n-rows",
- P_("Rows"),
- P_("The number of rows in the table"),
- 1,
- 65535,
- 1,
- GTK_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_N_COLUMNS,
- g_param_spec_uint ("n-columns",
- P_("Columns"),
- P_("The number of columns in the table"),
- 1,
- 65535,
- 1,
- GTK_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_ROW_SPACING,
- g_param_spec_uint ("row-spacing",
- P_("Row spacing"),
- P_("The amount of space between two consecutive rows"),
- 0,
- 65535,
- 0,
- GTK_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_COLUMN_SPACING,
- g_param_spec_uint ("column-spacing",
- P_("Column spacing"),
- P_("The amount of space between two consecutive columns"),
- 0,
- 65535,
- 0,
- GTK_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_HOMOGENEOUS,
- g_param_spec_boolean ("homogeneous",
- P_("Homogeneous"),
- P_("If TRUE, the table cells are all the same width/height"),
- FALSE,
- GTK_PARAM_READWRITE));
-
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_LEFT_ATTACH,
- g_param_spec_uint ("left-attach",
- P_("Left attachment"),
- P_("The column number to attach the left side of the child to"),
- 0, 65535, 0,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_RIGHT_ATTACH,
- g_param_spec_uint ("right-attach",
- P_("Right attachment"),
- P_("The column number to attach the right side of a child widget to"),
- 1, 65535, 1,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_TOP_ATTACH,
- g_param_spec_uint ("top-attach",
- P_("Top attachment"),
- P_("The row number to attach the top of a child widget to"),
- 0, 65535, 0,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_BOTTOM_ATTACH,
- g_param_spec_uint ("bottom-attach",
- P_("Bottom attachment"),
- P_("The row number to attach the bottom of the child to"),
- 1, 65535, 1,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_X_OPTIONS,
- g_param_spec_flags ("x-options",
- P_("Horizontal options"),
- P_("Options specifying the horizontal behaviour of the child"),
- GTK_TYPE_ATTACH_OPTIONS, GTK_EXPAND | GTK_FILL,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_Y_OPTIONS,
- g_param_spec_flags ("y-options",
- P_("Vertical options"),
- P_("Options specifying the vertical behaviour of the child"),
- GTK_TYPE_ATTACH_OPTIONS, GTK_EXPAND | GTK_FILL,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_X_PADDING,
- g_param_spec_uint ("x-padding",
- P_("Horizontal padding"),
- P_("Extra space to put between the child and its left and right neighbors, in pixels"),
- 0, 65535, 0,
- GTK_PARAM_READWRITE));
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_Y_PADDING,
- g_param_spec_uint ("y-padding",
- P_("Vertical padding"),
- P_("Extra space to put between the child and its upper and lower neighbors, in pixels"),
- 0, 65535, 0,
- GTK_PARAM_READWRITE));
-
- g_type_class_add_private (class, sizeof (GtkTablePrivate));
-}
-
-static void
-gtk_table_compute_expand (GtkWidget *widget,
- gboolean *hexpand_p,
- gboolean *vexpand_p)
-{
- GtkTable *table = GTK_TABLE (widget);
- GtkTablePrivate *priv = table->priv;
- GList *list;
- GtkTableChild *child;
- gboolean hexpand;
- gboolean vexpand;
-
- hexpand = FALSE;
- vexpand = FALSE;
-
- for (list = priv->children; list; list = list->next)
- {
- child = list->data;
-
- if (!hexpand)
- hexpand = child->xexpand ||
- gtk_widget_compute_expand (child->widget,
- GTK_ORIENTATION_HORIZONTAL);
-
- if (!vexpand)
- vexpand = child->yexpand ||
- gtk_widget_compute_expand (child->widget,
- GTK_ORIENTATION_VERTICAL);
-
- if (hexpand && vexpand)
- break;
- }
-
- *hexpand_p = hexpand;
- *vexpand_p = vexpand;
-}
-
-static GType
-gtk_table_child_type (GtkContainer *container)
-{
- return GTK_TYPE_WIDGET;
-}
-
-static void
-gtk_table_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkTable *table = GTK_TABLE (object);
- GtkTablePrivate *priv = table->priv;
-
- switch (prop_id)
- {
- case PROP_N_ROWS:
- g_value_set_uint (value, priv->nrows);
- break;
- case PROP_N_COLUMNS:
- g_value_set_uint (value, priv->ncols);
- break;
- case PROP_ROW_SPACING:
- g_value_set_uint (value, priv->row_spacing);
- break;
- case PROP_COLUMN_SPACING:
- g_value_set_uint (value, priv->column_spacing);
- break;
- case PROP_HOMOGENEOUS:
- g_value_set_boolean (value, priv->homogeneous);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gtk_table_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkTable *table = GTK_TABLE (object);
- GtkTablePrivate *priv = table->priv;
-
- switch (prop_id)
- {
- case PROP_N_ROWS:
- gtk_table_resize (table, g_value_get_uint (value), priv->ncols);
- break;
- case PROP_N_COLUMNS:
- gtk_table_resize (table, priv->nrows, g_value_get_uint (value));
- break;
- case PROP_ROW_SPACING:
- gtk_table_set_row_spacings (table, g_value_get_uint (value));
- break;
- case PROP_COLUMN_SPACING:
- gtk_table_set_col_spacings (table, g_value_get_uint (value));
- break;
- case PROP_HOMOGENEOUS:
- gtk_table_set_homogeneous (table, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gtk_table_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkTable *table = GTK_TABLE (container);
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *table_child;
- GList *list;
-
- table_child = NULL;
- for (list = priv->children; list; list = list->next)
- {
- table_child = list->data;
-
- if (table_child->widget == child)
- break;
- }
- if (!list)
- {
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- return;
- }
-
- switch (property_id)
- {
- case CHILD_PROP_LEFT_ATTACH:
- table_child->left_attach = g_value_get_uint (value);
- if (table_child->right_attach <= table_child->left_attach)
- table_child->right_attach = table_child->left_attach + 1;
- if (table_child->right_attach >= priv->ncols)
- gtk_table_resize (table, priv->nrows, table_child->right_attach);
- break;
- case CHILD_PROP_RIGHT_ATTACH:
- table_child->right_attach = g_value_get_uint (value);
- if (table_child->right_attach <= table_child->left_attach)
- table_child->left_attach = table_child->right_attach - 1;
- if (table_child->right_attach >= priv->ncols)
- gtk_table_resize (table, priv->nrows, table_child->right_attach);
- break;
- case CHILD_PROP_TOP_ATTACH:
- table_child->top_attach = g_value_get_uint (value);
- if (table_child->bottom_attach <= table_child->top_attach)
- table_child->bottom_attach = table_child->top_attach + 1;
- if (table_child->bottom_attach >= priv->nrows)
- gtk_table_resize (table, table_child->bottom_attach, priv->ncols);
- break;
- case CHILD_PROP_BOTTOM_ATTACH:
- table_child->bottom_attach = g_value_get_uint (value);
- if (table_child->bottom_attach <= table_child->top_attach)
- table_child->top_attach = table_child->bottom_attach - 1;
- if (table_child->bottom_attach >= priv->nrows)
- gtk_table_resize (table, table_child->bottom_attach, priv->ncols);
- break;
- case CHILD_PROP_X_OPTIONS:
- {
- gboolean xexpand;
-
- xexpand = (g_value_get_flags (value) & GTK_EXPAND) != 0;
-
- if (table_child->xexpand != xexpand)
- {
- table_child->xexpand = xexpand;
- gtk_widget_queue_compute_expand (GTK_WIDGET (table));
- }
-
- table_child->xshrink = (g_value_get_flags (value) & GTK_SHRINK) != 0;
- table_child->xfill = (g_value_get_flags (value) & GTK_FILL) != 0;
- }
- break;
- case CHILD_PROP_Y_OPTIONS:
- {
- gboolean yexpand;
-
- yexpand = (g_value_get_flags (value) & GTK_EXPAND) != 0;
-
- if (table_child->yexpand != yexpand)
- {
- table_child->yexpand = yexpand;
- gtk_widget_queue_compute_expand (GTK_WIDGET (table));
- }
-
- table_child->yshrink = (g_value_get_flags (value) & GTK_SHRINK) != 0;
- table_child->yfill = (g_value_get_flags (value) & GTK_FILL) != 0;
- }
- break;
- case CHILD_PROP_X_PADDING:
- table_child->xpadding = g_value_get_uint (value);
- break;
- case CHILD_PROP_Y_PADDING:
- table_child->ypadding = g_value_get_uint (value);
- break;
- default:
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- break;
- }
- if (gtk_widget_get_visible (child) &&
- gtk_widget_get_visible (GTK_WIDGET (table)))
- gtk_widget_queue_resize (child);
-}
-
-static void
-gtk_table_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkTable *table = GTK_TABLE (container);
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *table_child;
- GList *list;
-
- table_child = NULL;
- for (list = priv->children; list; list = list->next)
- {
- table_child = list->data;
-
- if (table_child->widget == child)
- break;
- }
- if (!list)
- {
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- return;
- }
-
- switch (property_id)
- {
- case CHILD_PROP_LEFT_ATTACH:
- g_value_set_uint (value, table_child->left_attach);
- break;
- case CHILD_PROP_RIGHT_ATTACH:
- g_value_set_uint (value, table_child->right_attach);
- break;
- case CHILD_PROP_TOP_ATTACH:
- g_value_set_uint (value, table_child->top_attach);
- break;
- case CHILD_PROP_BOTTOM_ATTACH:
- g_value_set_uint (value, table_child->bottom_attach);
- break;
- case CHILD_PROP_X_OPTIONS:
- g_value_set_flags (value, (table_child->xexpand * GTK_EXPAND |
- table_child->xshrink * GTK_SHRINK |
- table_child->xfill * GTK_FILL));
- break;
- case CHILD_PROP_Y_OPTIONS:
- g_value_set_flags (value, (table_child->yexpand * GTK_EXPAND |
- table_child->yshrink * GTK_SHRINK |
- table_child->yfill * GTK_FILL));
- break;
- case CHILD_PROP_X_PADDING:
- g_value_set_uint (value, table_child->xpadding);
- break;
- case CHILD_PROP_Y_PADDING:
- g_value_set_uint (value, table_child->ypadding);
- break;
- default:
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- break;
- }
-}
-
-static void
-gtk_table_init (GtkTable *table)
-{
- GtkTablePrivate *priv;
-
- table->priv = G_TYPE_INSTANCE_GET_PRIVATE (table,
- GTK_TYPE_TABLE,
- GtkTablePrivate);
- priv = table->priv;
-
- gtk_widget_set_has_window (GTK_WIDGET (table), FALSE);
- gtk_widget_set_redraw_on_allocate (GTK_WIDGET (table), FALSE);
-
- priv->children = NULL;
- priv->rows = NULL;
- priv->cols = NULL;
- priv->nrows = 0;
- priv->ncols = 0;
- priv->column_spacing = 0;
- priv->row_spacing = 0;
- priv->homogeneous = FALSE;
-
- gtk_table_resize (table, 1, 1);
-}
-
-/**
- * gtk_table_new:
- * @rows: The number of rows the new table should have.
- * @columns: The number of columns the new table should have.
- * @homogeneous: If set to %TRUE, all table cells are resized to the size of
- * the cell containing the largest widget.
- *
- * Used to create a new table widget. An initial size must be given by
- * specifying how many rows and columns the table should have, although
- * this can be changed later with gtk_table_resize(). @rows and @columns
- * must both be in the range 1 .. 65535. For historical reasons, 0 is accepted
- * as well and is silently interpreted as 1.
- *
- * Returns: A pointer to the the newly created table widget.
- *
- * Deprecated: 3.4: Use gtk_grid_new().
- */
-GtkWidget*
-gtk_table_new (guint rows,
- guint columns,
- gboolean homogeneous)
-{
- GtkTable *table;
- GtkTablePrivate *priv;
-
- if (rows == 0)
- rows = 1;
- if (columns == 0)
- columns = 1;
-
- table = g_object_new (GTK_TYPE_TABLE, NULL);
- priv = table->priv;
-
- priv->homogeneous = (homogeneous ? TRUE : FALSE);
-
- gtk_table_resize (table, rows, columns);
-
- return GTK_WIDGET (table);
-}
-
-/**
- * gtk_table_resize:
- * @table: The #GtkTable you wish to change the size of.
- * @rows: The new number of rows.
- * @columns: The new number of columns.
- *
- * If you need to change a table's size <emphasis>after</emphasis>
- * it has been created, this function allows you to do so.
- *
- * Deprecated: 3.4: #GtkGrid resizes automatically.
- */
-void
-gtk_table_resize (GtkTable *table,
- guint n_rows,
- guint n_cols)
-{
- GtkTablePrivate *priv;
-
- g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail (n_rows > 0 && n_rows <= 65535);
- g_return_if_fail (n_cols > 0 && n_cols <= 65535);
-
- priv = table->priv;
-
- n_rows = MAX (n_rows, 1);
- n_cols = MAX (n_cols, 1);
-
- if (n_rows != priv->nrows ||
- n_cols != priv->ncols)
- {
- GList *list;
-
- for (list = priv->children; list; list = list->next)
- {
- GtkTableChild *child;
-
- child = list->data;
-
- n_rows = MAX (n_rows, child->bottom_attach);
- n_cols = MAX (n_cols, child->right_attach);
- }
-
- if (n_rows != priv->nrows)
- {
- guint i;
-
- i = priv->nrows;
- priv->nrows = n_rows;
- priv->rows = g_realloc (priv->rows, priv->nrows * sizeof (GtkTableRowCol));
-
- for (; i < priv->nrows; i++)
- {
- priv->rows[i].requisition = 0;
- priv->rows[i].allocation = 0;
- priv->rows[i].spacing = priv->row_spacing;
- priv->rows[i].need_expand = 0;
- priv->rows[i].need_shrink = 0;
- priv->rows[i].expand = 0;
- priv->rows[i].shrink = 0;
- }
-
- g_object_notify (G_OBJECT (table), "n-rows");
- }
-
- if (n_cols != priv->ncols)
- {
- guint i;
-
- i = priv->ncols;
- priv->ncols = n_cols;
- priv->cols = g_realloc (priv->cols, priv->ncols * sizeof (GtkTableRowCol));
-
- for (; i < priv->ncols; i++)
- {
- priv->cols[i].requisition = 0;
- priv->cols[i].allocation = 0;
- priv->cols[i].spacing = priv->column_spacing;
- priv->cols[i].need_expand = 0;
- priv->cols[i].need_shrink = 0;
- priv->cols[i].expand = 0;
- priv->cols[i].shrink = 0;
- }
-
- g_object_notify (G_OBJECT (table), "n-columns");
- }
- }
-}
-
-/**
- * gtk_table_attach:
- * @table: The #GtkTable to add a new widget to.
- * @child: The widget to add.
- * @left_attach: the column number to attach the left side of a child widget to.
- * @right_attach: the column number to attach the right side of a child widget to.
- * @top_attach: the row number to attach the top of a child widget to.
- * @bottom_attach: the row number to attach the bottom of a child widget to.
- * @xoptions: Used to specify the properties of the child widget when the table is resized.
- * @yoptions: The same as xoptions, except this field determines behaviour of vertical resizing.
- * @xpadding: An integer value specifying the padding on the left and right of the widget being added to the table.
- * @ypadding: The amount of padding above and below the child widget.
- *
- * Adds a widget to a table. The number of 'cells' that a widget will occupy is
- * specified by @left_attach, @right_attach, @top_attach and @bottom_attach.
- * These each represent the leftmost, rightmost, uppermost and lowest column
- * and row numbers of the table. (Columns and rows are indexed from zero).
- *
- * To make a button occupy the lower right cell of a 2x2 table, use
- * <informalexample><programlisting>
- * gtk_table_attach (table, button,
- * 1, 2, // left, right attach
- * 1, 2, // top, bottom attach
- * xoptions, yoptions,
- * xpadding, ypadding);
- * </programlisting></informalexample>
- * If you want to make the button span the entire bottom row, use @left_attach == 0 and @right_attach = 2 instead.
- *
- * Deprecated: 3.4: Use gtk_grid_attach() with #GtkGrid. Note that the attach
- * arguments differ between those two functions.
- */
-void
-gtk_table_attach (GtkTable *table,
- GtkWidget *child,
- guint left_attach,
- guint right_attach,
- guint top_attach,
- guint bottom_attach,
- GtkAttachOptions xoptions,
- GtkAttachOptions yoptions,
- guint xpadding,
- guint ypadding)
-{
- GtkTablePrivate *priv;
- GtkTableChild *table_child;
-
- g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (gtk_widget_get_parent (child) == NULL);
-
- /* g_return_if_fail (left_attach >= 0); */
- g_return_if_fail (left_attach < right_attach);
- /* g_return_if_fail (top_attach >= 0); */
- g_return_if_fail (top_attach < bottom_attach);
-
- priv = table->priv;
-
- if (right_attach >= priv->ncols)
- gtk_table_resize (table, priv->nrows, right_attach);
-
- if (bottom_attach >= priv->nrows)
- gtk_table_resize (table, bottom_attach, priv->ncols);
-
- table_child = g_new (GtkTableChild, 1);
- table_child->widget = child;
- table_child->left_attach = left_attach;
- table_child->right_attach = right_attach;
- table_child->top_attach = top_attach;
- table_child->bottom_attach = bottom_attach;
- table_child->xexpand = (xoptions & GTK_EXPAND) != 0;
- table_child->xshrink = (xoptions & GTK_SHRINK) != 0;
- table_child->xfill = (xoptions & GTK_FILL) != 0;
- table_child->xpadding = xpadding;
- table_child->yexpand = (yoptions & GTK_EXPAND) != 0;
- table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
- table_child->yfill = (yoptions & GTK_FILL) != 0;
- table_child->ypadding = ypadding;
-
- priv->children = g_list_prepend (priv->children, table_child);
-
- gtk_widget_set_parent (child, GTK_WIDGET (table));
-}
-
-/**
- * gtk_table_attach_defaults:
- * @table: The table to add a new child widget to.
- * @widget: The child widget to add.
- * @left_attach: The column number to attach the left side of the child widget to.
- * @right_attach: The column number to attach the right side of the child widget to.
- * @top_attach: The row number to attach the top of the child widget to.
- * @bottom_attach: The row number to attach the bottom of the child widget to.
- *
- * As there are many options associated with gtk_table_attach(), this convenience
- * function provides the programmer with a means to add children to a table with
- * identical padding and expansion options. The values used for the #GtkAttachOptions
- * are <literal>GTK_EXPAND | GTK_FILL</literal>, and the padding is set to 0.
- *
- * Deprecated: 3.4: Use gtk_grid_attach() with #GtkGrid. Note that the attach
- * arguments differ between those two functions.
- */
-void
-gtk_table_attach_defaults (GtkTable *table,
- GtkWidget *widget,
- guint left_attach,
- guint right_attach,
- guint top_attach,
- guint bottom_attach)
-{
- gtk_table_attach (table, widget,
- left_attach, right_attach,
- top_attach, bottom_attach,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-}
-
-/**
- * gtk_table_set_row_spacing:
- * @table: a #GtkTable containing the row whose properties you wish to change.
- * @row: row number whose spacing will be changed.
- * @spacing: number of pixels that the spacing should take up.
- *
- * Changes the space between a given table row and the subsequent row.
- *
- * Deprecated: 3.4: Use gtk_widget_set_margin_top() and
- * gtk_widget_set_margin_bottom() on the widgets contained in the row if
- * you need this functionality. #GtkGrid does not support per-row spacing.
- */
-void
-gtk_table_set_row_spacing (GtkTable *table,
- guint row,
- guint spacing)
-{
- GtkTablePrivate *priv;
-
- g_return_if_fail (GTK_IS_TABLE (table));
-
- priv = table->priv;
-
- g_return_if_fail (row < priv->nrows);
-
- if (priv->rows[row].spacing != spacing)
- {
- priv->rows[row].spacing = spacing;
-
- if (gtk_widget_get_visible (GTK_WIDGET (table)))
- gtk_widget_queue_resize (GTK_WIDGET (table));
- }
-}
-
-/**
- * gtk_table_get_row_spacing:
- * @table: a #GtkTable
- * @row: a row in the table, 0 indicates the first row
- *
- * Gets the amount of space between row @row, and
- * row @row + 1. See gtk_table_set_row_spacing().
- *
- * Return value: the row spacing
- *
- * Deprecated: 3.4: #GtkGrid does not offer a replacement for this
- * functionality.
- **/
-guint
-gtk_table_get_row_spacing (GtkTable *table,
- guint row)
-{
- GtkTablePrivate *priv;
-
- g_return_val_if_fail (GTK_IS_TABLE (table), 0);
-
- priv = table->priv;
-
- g_return_val_if_fail (row < priv->nrows - 1, 0);
-
- return priv->rows[row].spacing;
-}
-
-/**
- * gtk_table_set_col_spacing:
- * @table: a #GtkTable.
- * @column: the column whose spacing should be changed.
- * @spacing: number of pixels that the spacing should take up.
- *
- * Alters the amount of space between a given table column and the following
- * column.
- *
- * Deprecated: 3.4: Use gtk_widget_set_margin_left() and
- * gtk_widget_set_margin_right() on the widgets contained in the row if
- * you need this functionality. #GtkGrid does not support per-row spacing.
- */
-void
-gtk_table_set_col_spacing (GtkTable *table,
- guint column,
- guint spacing)
-{
- GtkTablePrivate *priv;
-
- g_return_if_fail (GTK_IS_TABLE (table));
-
- priv = table->priv;
-
- g_return_if_fail (column < priv->ncols);
-
- if (priv->cols[column].spacing != spacing)
- {
- priv->cols[column].spacing = spacing;
-
- if (gtk_widget_get_visible (GTK_WIDGET (table)))
- gtk_widget_queue_resize (GTK_WIDGET (table));
- }
-}
-
-/**
- * gtk_table_get_col_spacing:
- * @table: a #GtkTable
- * @column: a column in the table, 0 indicates the first column
- *
- * Gets the amount of space between column @col, and
- * column @col + 1. See gtk_table_set_col_spacing().
- *
- * Return value: the column spacing
- *
- * Deprecated: 3.4: #GtkGrid does not offer a replacement for this
- * functionality.
- **/
-guint
-gtk_table_get_col_spacing (GtkTable *table,
- guint column)
-{
- GtkTablePrivate *priv;
-
- g_return_val_if_fail (GTK_IS_TABLE (table), 0);
-
- priv = table->priv;
-
- g_return_val_if_fail (column < priv->ncols, 0);
-
- return priv->cols[column].spacing;
-}
-
-/**
- * gtk_table_set_row_spacings:
- * @table: a #GtkTable.
- * @spacing: the number of pixels of space to place between every row in the table.
- *
- * Sets the space between every row in @table equal to @spacing.
- *
- * Deprecated: 3.4: Use gtk_grid_set_row_spacing() with #GtkGrid.
- */
-void
-gtk_table_set_row_spacings (GtkTable *table,
- guint spacing)
-{
- GtkTablePrivate *priv;
- guint row;
-
- g_return_if_fail (GTK_IS_TABLE (table));
-
- priv = table->priv;
-
- priv->row_spacing = spacing;
- for (row = 0; row < priv->nrows; row++)
- priv->rows[row].spacing = spacing;
-
- if (gtk_widget_get_visible (GTK_WIDGET (table)))
- gtk_widget_queue_resize (GTK_WIDGET (table));
-
- g_object_notify (G_OBJECT (table), "row-spacing");
-}
-
-/**
- * gtk_table_get_default_row_spacing:
- * @table: a #GtkTable
- *
- * Gets the default row spacing for the table. This is
- * the spacing that will be used for newly added rows.
- * (See gtk_table_set_row_spacings())
- *
- * Return value: the default row spacing
- *
- * Deprecated: 3.4: Use gtk_grid_get_row_spacing() with #GtkGrid.
- **/
-guint
-gtk_table_get_default_row_spacing (GtkTable *table)
-{
- g_return_val_if_fail (GTK_IS_TABLE (table), 0);
-
- return table->priv->row_spacing;
-}
-
-/**
- * gtk_table_set_col_spacings:
- * @table: a #GtkTable.
- * @spacing: the number of pixels of space to place between every column
- * in the table.
- *
- * Sets the space between every column in @table equal to @spacing.
- *
- * Deprecated: 3.4: Use gtk_grid_set_column_spacing() with #GtkGrid.
- */
-void
-gtk_table_set_col_spacings (GtkTable *table,
- guint spacing)
-{
- GtkTablePrivate *priv;
- guint col;
-
- g_return_if_fail (GTK_IS_TABLE (table));
-
- priv = table->priv;
-
- priv->column_spacing = spacing;
- for (col = 0; col < priv->ncols; col++)
- priv->cols[col].spacing = spacing;
-
- if (gtk_widget_get_visible (GTK_WIDGET (table)))
- gtk_widget_queue_resize (GTK_WIDGET (table));
-
- g_object_notify (G_OBJECT (table), "column-spacing");
-}
-
-/**
- * gtk_table_get_default_col_spacing:
- * @table: a #GtkTable
- *
- * Gets the default column spacing for the table. This is
- * the spacing that will be used for newly added columns.
- * (See gtk_table_set_col_spacings())
- *
- * Return value: the default column spacing
- *
- * Deprecated: 3.4: Use gtk_grid_get_column_spacing() with #GtkGrid.
- **/
-guint
-gtk_table_get_default_col_spacing (GtkTable *table)
-{
- g_return_val_if_fail (GTK_IS_TABLE (table), 0);
-
- return table->priv->column_spacing;
-}
-
-/**
- * gtk_table_set_homogeneous:
- * @table: The #GtkTable you wish to set the homogeneous properties of.
- * @homogeneous: Set to %TRUE to ensure all table cells are the same size. Set
- * to %FALSE if this is not your desired behaviour.
- *
- * Changes the homogenous property of table cells, ie. whether all cells are
- * an equal size or not.
- *
- * Deprecated: 3.4: Use gtk_grid_set_row_homogeneous() and
- * gtk_grid_set_column_homogeneous() with #GtkGrid.
- */
-void
-gtk_table_set_homogeneous (GtkTable *table,
- gboolean homogeneous)
-{
- GtkTablePrivate *priv;
-
- g_return_if_fail (GTK_IS_TABLE (table));
-
- priv = table->priv;
-
- homogeneous = (homogeneous != 0);
- if (homogeneous != priv->homogeneous)
- {
- priv->homogeneous = homogeneous;
-
- if (gtk_widget_get_visible (GTK_WIDGET (table)))
- gtk_widget_queue_resize (GTK_WIDGET (table));
-
- g_object_notify (G_OBJECT (table), "homogeneous");
- }
-}
-
-/**
- * gtk_table_get_homogeneous:
- * @table: a #GtkTable
- *
- * Returns whether the table cells are all constrained to the same
- * width and height. (See gtk_table_set_homogenous ())
- *
- * Return value: %TRUE if the cells are all constrained to the same size
- *
- * Deprecated: 3.4: Use gtk_grid_get_row_homogeneous() and
- * gtk_grid_get_column_homogeneous() with #GtkGrid.
- **/
-gboolean
-gtk_table_get_homogeneous (GtkTable *table)
-{
- g_return_val_if_fail (GTK_IS_TABLE (table), FALSE);
-
- return table->priv->homogeneous;
-}
-
-/**
- * gtk_table_get_size:
- * @table: a #GtkTable
- * @rows: (out) (allow-none): return location for the number of
- * rows, or %NULL
- * @columns: (out) (allow-none): return location for the number
- * of columns, or %NULL
- *
- * Gets the number of rows and columns in the table.
- *
- * Since: 2.22
- *
- * Deprecated: 3.4: #GtkGrid does not expose the number of columns and
- * rows.
- **/
-void
-gtk_table_get_size (GtkTable *table,
- guint *rows,
- guint *columns)
-{
- GtkTablePrivate *priv;
-
- g_return_if_fail (GTK_IS_TABLE (table));
-
- priv = table->priv;
-
- if (rows)
- *rows = priv->nrows;
-
- if (columns)
- *columns = priv->ncols;
-}
-
-static void
-gtk_table_finalize (GObject *object)
-{
- GtkTable *table = GTK_TABLE (object);
- GtkTablePrivate *priv = table->priv;
-
- g_free (priv->rows);
- g_free (priv->cols);
-
- G_OBJECT_CLASS (gtk_table_parent_class)->finalize (object);
-}
-
-static void
-gtk_table_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkTable *table = GTK_TABLE (widget);
- GtkTablePrivate *priv = table->priv;
- gint col;
-
- gtk_table_size_request_init (table);
- gtk_table_size_request_pass1 (table);
- gtk_table_size_request_pass2 (table);
- gtk_table_size_request_pass3 (table);
- gtk_table_size_request_pass2 (table);
-
- *minimum = 0;
-
- for (col = 0; col < priv->ncols; col++)
- *minimum += priv->cols[col].requisition;
- for (col = 0; col + 1 < priv->ncols; col++)
- *minimum += priv->cols[col].spacing;
-
- *natural = *minimum;
-}
-
-static void
-gtk_table_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkTable *table = GTK_TABLE (widget);
- GtkTablePrivate *priv = table->priv;
- gint row;
-
- gtk_table_size_request_init (table);
- gtk_table_size_request_pass1 (table);
- gtk_table_size_request_pass2 (table);
- gtk_table_size_request_pass3 (table);
- gtk_table_size_request_pass2 (table);
-
- *minimum = 0;
- for (row = 0; row < priv->nrows; row++)
- *minimum += priv->rows[row].requisition;
- for (row = 0; row + 1 < priv->nrows; row++)
- *minimum += priv->rows[row].spacing;
-
- *natural = *minimum;
-}
-
-static void
-gtk_table_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkTable *table = GTK_TABLE (widget);
-
- gtk_widget_set_allocation (widget, allocation);
-
- gtk_table_size_allocate_init (table);
- gtk_table_size_allocate_pass1 (table);
- gtk_table_size_allocate_pass2 (table);
-}
-
-static void
-gtk_table_add (GtkContainer *container,
- GtkWidget *widget)
-{
- gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
-}
-
-static void
-gtk_table_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkTable *table = GTK_TABLE (container);
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GtkWidget *widget_container = GTK_WIDGET (container);
- GList *children;
-
- children = priv->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->widget == widget)
- {
- gboolean was_visible = gtk_widget_get_visible (widget);
-
- gtk_widget_unparent (widget);
-
- priv->children = g_list_remove (priv->children, child);
- g_free (child);
-
- if (was_visible && gtk_widget_get_visible (widget_container))
- gtk_widget_queue_resize (widget_container);
- break;
- }
- }
-}
-
-static void
-gtk_table_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkTable *table = GTK_TABLE (container);
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GList *children;
-
- children = priv->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- (* callback) (child->widget, callback_data);
- }
-}
-
-static void
-gtk_table_size_request_init (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GList *children;
- gint row, col;
-
- for (row = 0; row < priv->nrows; row++)
- {
- priv->rows[row].requisition = 0;
- priv->rows[row].expand = FALSE;
- }
- for (col = 0; col < priv->ncols; col++)
- {
- priv->cols[col].requisition = 0;
- priv->cols[col].expand = FALSE;
- }
-
- children = priv->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->left_attach == (child->right_attach - 1) &&
- (child->xexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_HORIZONTAL)))
- priv->cols[child->left_attach].expand = TRUE;
-
- if (child->top_attach == (child->bottom_attach - 1) &&
- (child->yexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_VERTICAL)))
- priv->rows[child->top_attach].expand = TRUE;
- }
-}
-
-static void
-gtk_table_size_request_pass1 (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GList *children;
- gint width;
- gint height;
-
- children = priv->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_get_visible (child->widget))
- {
- GtkRequisition child_requisition;
-
- gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
-
- /* Child spans a single column.
- */
- if (child->left_attach == (child->right_attach - 1))
- {
- width = child_requisition.width + child->xpadding * 2;
- priv->cols[child->left_attach].requisition = MAX (priv->cols[child->left_attach].requisition, width);
- }
-
- /* Child spans a single row.
- */
- if (child->top_attach == (child->bottom_attach - 1))
- {
- height = child_requisition.height + child->ypadding * 2;
- priv->rows[child->top_attach].requisition = MAX (priv->rows[child->top_attach].requisition, height);
- }
- }
- }
-}
-
-static void
-gtk_table_size_request_pass2 (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- gint max_width;
- gint max_height;
- gint row, col;
-
- if (priv->homogeneous)
- {
- max_width = 0;
- max_height = 0;
-
- for (col = 0; col < priv->ncols; col++)
- max_width = MAX (max_width, priv->cols[col].requisition);
- for (row = 0; row < priv->nrows; row++)
- max_height = MAX (max_height, priv->rows[row].requisition);
-
- for (col = 0; col < priv->ncols; col++)
- priv->cols[col].requisition = max_width;
- for (row = 0; row < priv->nrows; row++)
- priv->rows[row].requisition = max_height;
- }
-}
-
-static void
-gtk_table_size_request_pass3 (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GList *children;
- gint width, height;
- gint row, col;
- gint extra;
-
- children = priv->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_get_visible (child->widget))
- {
- /* Child spans multiple columns.
- */
- if (child->left_attach != (child->right_attach - 1))
- {
- GtkRequisition child_requisition;
-
- gtk_widget_get_preferred_size (child->widget,
- &child_requisition, NULL);
-
- /* Check and see if there is already enough space
- * for the child.
- */
- width = 0;
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- width += priv->cols[col].requisition;
- if ((col + 1) < child->right_attach)
- width += priv->cols[col].spacing;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space amongst the
- * columns it spans, favoring expandable columns if any.
- */
- if (width < child_requisition.width + child->xpadding * 2)
- {
- gint n_expand = 0;
- gboolean force_expand = FALSE;
-
- width = child_requisition.width + child->xpadding * 2 - width;
-
- for (col = child->left_attach; col < child->right_attach; col++)
- if (priv->cols[col].expand)
- n_expand++;
-
- if (n_expand == 0)
- {
- n_expand = (child->right_attach - child->left_attach);
- force_expand = TRUE;
- }
-
- for (col = child->left_attach; col < child->right_attach; col++)
- if (force_expand || priv->cols[col].expand)
- {
- extra = width / n_expand;
- priv->cols[col].requisition += extra;
- width -= extra;
- n_expand--;
- }
- }
- }
-
- /* Child spans multiple rows.
- */
- if (child->top_attach != (child->bottom_attach - 1))
- {
- GtkRequisition child_requisition;
-
- gtk_widget_get_preferred_size (child->widget,
- &child_requisition, NULL);
-
- /* Check and see if there is already enough space
- * for the child.
- */
- height = 0;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- height += priv->rows[row].requisition;
- if ((row + 1) < child->bottom_attach)
- height += priv->rows[row].spacing;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space amongst the
- * rows it spans, favoring expandable rows if any.
- */
- if (height < child_requisition.height + child->ypadding * 2)
- {
- gint n_expand = 0;
- gboolean force_expand = FALSE;
-
- height = child_requisition.height + child->ypadding * 2 - height;
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- if (priv->rows[row].expand)
- n_expand++;
- }
-
- if (n_expand == 0)
- {
- n_expand = (child->bottom_attach - child->top_attach);
- force_expand = TRUE;
- }
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (force_expand || priv->rows[row].expand)
- {
- extra = height / n_expand;
- priv->rows[row].requisition += extra;
- height -= extra;
- n_expand--;
- }
- }
- }
- }
- }
-}
-
-static void
-gtk_table_size_allocate_init (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GList *children;
- gint row, col;
- gint has_expand;
- gint has_shrink;
-
- /* Initialize the rows and cols.
- * By default, rows and cols do not expand and do shrink.
- * Those values are modified by the children that occupy
- * the rows and cols.
- */
- for (col = 0; col < priv->ncols; col++)
- {
- priv->cols[col].allocation = priv->cols[col].requisition;
- priv->cols[col].need_expand = FALSE;
- priv->cols[col].need_shrink = TRUE;
- priv->cols[col].expand = FALSE;
- priv->cols[col].shrink = TRUE;
- priv->cols[col].empty = TRUE;
- }
- for (row = 0; row < priv->nrows; row++)
- {
- priv->rows[row].allocation = priv->rows[row].requisition;
- priv->rows[row].need_expand = FALSE;
- priv->rows[row].need_shrink = TRUE;
- priv->rows[row].expand = FALSE;
- priv->rows[row].shrink = TRUE;
- priv->rows[row].empty = TRUE;
- }
-
- /* Loop over all the children and adjust the row and col values
- * based on whether the children want to be allowed to expand
- * or shrink. This loop handles children that occupy a single
- * row or column.
- */
- children = priv->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_get_visible (child->widget))
- {
- if (child->left_attach == (child->right_attach - 1))
- {
- if (child->xexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_HORIZONTAL))
- priv->cols[child->left_attach].expand = TRUE;
-
- if (!child->xshrink)
- priv->cols[child->left_attach].shrink = FALSE;
-
- priv->cols[child->left_attach].empty = FALSE;
- }
-
- if (child->top_attach == (child->bottom_attach - 1))
- {
- if (child->yexpand || gtk_widget_compute_expand (child->widget, GTK_ORIENTATION_VERTICAL))
- priv->rows[child->top_attach].expand = TRUE;
-
- if (!child->yshrink)
- priv->rows[child->top_attach].shrink = FALSE;
-
- priv->rows[child->top_attach].empty = FALSE;
- }
- }
- }
-
- /* Loop over all the children again and this time handle children
- * which span multiple rows or columns.
- */
- children = priv->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_get_visible (child->widget))
- {
- if (child->left_attach != (child->right_attach - 1))
- {
- for (col = child->left_attach; col < child->right_attach; col++)
- priv->cols[col].empty = FALSE;
-
- if (child->xexpand)
- {
- has_expand = FALSE;
- for (col = child->left_attach; col < child->right_attach; col++)
- if (priv->cols[col].expand)
- {
- has_expand = TRUE;
- break;
- }
-
- if (!has_expand)
- for (col = child->left_attach; col < child->right_attach; col++)
- priv->cols[col].need_expand = TRUE;
- }
-
- if (!child->xshrink)
- {
- has_shrink = TRUE;
- for (col = child->left_attach; col < child->right_attach; col++)
- if (!priv->cols[col].shrink)
- {
- has_shrink = FALSE;
- break;
- }
-
- if (has_shrink)
- for (col = child->left_attach; col < child->right_attach; col++)
- priv->cols[col].need_shrink = FALSE;
- }
- }
-
- if (child->top_attach != (child->bottom_attach - 1))
- {
- for (row = child->top_attach; row < child->bottom_attach; row++)
- priv->rows[row].empty = FALSE;
-
- if (child->yexpand)
- {
- has_expand = FALSE;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (priv->rows[row].expand)
- {
- has_expand = TRUE;
- break;
- }
-
- if (!has_expand)
- for (row = child->top_attach; row < child->bottom_attach; row++)
- priv->rows[row].need_expand = TRUE;
- }
-
- if (!child->yshrink)
- {
- has_shrink = TRUE;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (!priv->rows[row].shrink)
- {
- has_shrink = FALSE;
- break;
- }
-
- if (has_shrink)
- for (row = child->top_attach; row < child->bottom_attach; row++)
- priv->rows[row].need_shrink = FALSE;
- }
- }
- }
- }
-
- /* Loop over the columns and set the expand and shrink values
- * if the column can be expanded or shrunk.
- */
- for (col = 0; col < priv->ncols; col++)
- {
- if (priv->cols[col].empty)
- {
- priv->cols[col].expand = FALSE;
- priv->cols[col].shrink = FALSE;
- }
- else
- {
- if (priv->cols[col].need_expand)
- priv->cols[col].expand = TRUE;
- if (!priv->cols[col].need_shrink)
- priv->cols[col].shrink = FALSE;
- }
- }
-
- /* Loop over the rows and set the expand and shrink values
- * if the row can be expanded or shrunk.
- */
- for (row = 0; row < priv->nrows; row++)
- {
- if (priv->rows[row].empty)
- {
- priv->rows[row].expand = FALSE;
- priv->rows[row].shrink = FALSE;
- }
- else
- {
- if (priv->rows[row].need_expand)
- priv->rows[row].expand = TRUE;
- if (!priv->rows[row].need_shrink)
- priv->rows[row].shrink = FALSE;
- }
- }
-}
-
-static void
-gtk_table_size_allocate_pass1 (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- GtkAllocation allocation;
- gint real_width;
- gint real_height;
- gint width, height;
- gint row, col;
- gint nexpand;
- gint nshrink;
- gint extra;
-
- /* If we were allocated more space than we requested
- * then we have to expand any expandable rows and columns
- * to fill in the extra space.
- */
- gtk_widget_get_allocation (GTK_WIDGET (table), &allocation);
- real_width = allocation.width;
- real_height = allocation.height;
-
- if (priv->homogeneous)
- {
- if (!priv->children)
- nexpand = 1;
- else
- {
- nexpand = 0;
- for (col = 0; col < priv->ncols; col++)
- if (priv->cols[col].expand)
- {
- nexpand += 1;
- break;
- }
- }
- if (nexpand)
- {
- width = real_width;
- for (col = 0; col + 1 < priv->ncols; col++)
- width -= priv->cols[col].spacing;
-
- for (col = 0; col < priv->ncols; col++)
- {
- extra = width / (priv->ncols - col);
- priv->cols[col].allocation = MAX (1, extra);
- width -= extra;
- }
- }
- }
- else
- {
- width = 0;
- nexpand = 0;
- nshrink = 0;
-
- for (col = 0; col < priv->ncols; col++)
- {
- width += priv->cols[col].requisition;
- if (priv->cols[col].expand)
- nexpand += 1;
- if (priv->cols[col].shrink)
- nshrink += 1;
- }
- for (col = 0; col + 1 < priv->ncols; col++)
- width += priv->cols[col].spacing;
-
- /* Check to see if we were allocated more width than we requested.
- */
- if ((width < real_width) && (nexpand >= 1))
- {
- width = real_width - width;
-
- for (col = 0; col < priv->ncols; col++)
- if (priv->cols[col].expand)
- {
- extra = width / nexpand;
- priv->cols[col].allocation += extra;
-
- width -= extra;
- nexpand -= 1;
- }
- }
-
- /* Check to see if we were allocated less width than we requested,
- * then shrink until we fit the size give.
- */
- if (width > real_width)
- {
- gint total_nshrink = nshrink;
-
- extra = width - real_width;
- while (total_nshrink > 0 && extra > 0)
- {
- nshrink = total_nshrink;
- for (col = 0; col < priv->ncols; col++)
- if (priv->cols[col].shrink)
- {
- gint allocation = priv->cols[col].allocation;
-
- priv->cols[col].allocation = MAX (1, (gint) priv->cols[col].allocation - extra / nshrink);
- extra -= allocation - priv->cols[col].allocation;
- nshrink -= 1;
- if (priv->cols[col].allocation < 2)
- {
- total_nshrink -= 1;
- priv->cols[col].shrink = FALSE;
- }
- }
- }
- }
- }
-
- if (priv->homogeneous)
- {
- if (!priv->children)
- nexpand = 1;
- else
- {
- nexpand = 0;
- for (row = 0; row < priv->nrows; row++)
- if (priv->rows[row].expand)
- {
- nexpand += 1;
- break;
- }
- }
- if (nexpand)
- {
- height = real_height;
-
- for (row = 0; row + 1 < priv->nrows; row++)
- height -= priv->rows[row].spacing;
-
- for (row = 0; row < priv->nrows; row++)
- {
- extra = height / (priv->nrows - row);
- priv->rows[row].allocation = MAX (1, extra);
- height -= extra;
- }
- }
- }
- else
- {
- height = 0;
- nexpand = 0;
- nshrink = 0;
-
- for (row = 0; row < priv->nrows; row++)
- {
- height += priv->rows[row].requisition;
- if (priv->rows[row].expand)
- nexpand += 1;
- if (priv->rows[row].shrink)
- nshrink += 1;
- }
- for (row = 0; row + 1 < priv->nrows; row++)
- height += priv->rows[row].spacing;
-
- /* Check to see if we were allocated more height than we requested.
- */
- if ((height < real_height) && (nexpand >= 1))
- {
- height = real_height - height;
-
- for (row = 0; row < priv->nrows; row++)
- if (priv->rows[row].expand)
- {
- extra = height / nexpand;
- priv->rows[row].allocation += extra;
-
- height -= extra;
- nexpand -= 1;
- }
- }
-
- /* Check to see if we were allocated less height than we requested.
- * then shrink until we fit the size give.
- */
- if (height > real_height)
- {
- gint total_nshrink = nshrink;
-
- extra = height - real_height;
- while (total_nshrink > 0 && extra > 0)
- {
- nshrink = total_nshrink;
- for (row = 0; row < priv->nrows; row++)
- if (priv->rows[row].shrink)
- {
- gint allocation = priv->rows[row].allocation;
-
- priv->rows[row].allocation = MAX (1, (gint) priv->rows[row].allocation - extra / nshrink);
- extra -= allocation - priv->rows[row].allocation;
- nshrink -= 1;
- if (priv->rows[row].allocation < 2)
- {
- total_nshrink -= 1;
- priv->rows[row].shrink = FALSE;
- }
- }
- }
- }
- }
-}
-
-static void
-gtk_table_size_allocate_pass2 (GtkTable *table)
-{
- GtkTablePrivate *priv = table->priv;
- GtkTableChild *child;
- GList *children;
- gint max_width;
- gint max_height;
- gint x, y;
- gint row, col;
- GtkAllocation allocation;
- GtkAllocation table_allocation, widget_allocation;
- GtkWidget *widget = GTK_WIDGET (table);
-
- children = priv->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_get_visible (child->widget))
- {
- GtkRequisition child_requisition;
-
- gtk_widget_get_preferred_size (child->widget,
- &child_requisition, NULL);
-
- gtk_widget_get_allocation (GTK_WIDGET (table), &table_allocation);
- x = table_allocation.x;
- y = table_allocation.y;
- max_width = 0;
- max_height = 0;
-
- for (col = 0; col < child->left_attach; col++)
- {
- x += priv->cols[col].allocation;
- x += priv->cols[col].spacing;
- }
-
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- max_width += priv->cols[col].allocation;
- if ((col + 1) < child->right_attach)
- max_width += priv->cols[col].spacing;
- }
-
- for (row = 0; row < child->top_attach; row++)
- {
- y += priv->rows[row].allocation;
- y += priv->rows[row].spacing;
- }
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- max_height += priv->rows[row].allocation;
- if ((row + 1) < child->bottom_attach)
- max_height += priv->rows[row].spacing;
- }
-
- if (child->xfill)
- {
- allocation.width = MAX (1, max_width - (gint)child->xpadding * 2);
- allocation.x = x + (max_width - allocation.width) / 2;
- }
- else
- {
- allocation.width = child_requisition.width;
- allocation.x = x + (max_width - allocation.width) / 2;
- }
-
- if (child->yfill)
- {
- allocation.height = MAX (1, max_height - (gint)child->ypadding * 2);
- allocation.y = y + (max_height - allocation.height) / 2;
- }
- else
- {
- allocation.height = child_requisition.height;
- allocation.y = y + (max_height - allocation.height) / 2;
- }
-
- gtk_widget_get_allocation (widget, &widget_allocation);
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- allocation.x = widget_allocation.x + widget_allocation.width
- - (allocation.x - widget_allocation.x) - allocation.width;
-
- gtk_widget_size_allocate (child->widget, &allocation);
- }
- }
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_TABLE_H__
-#define __GTK_TABLE_H__
-
-
-#include <gtk/gtkcontainer.h>
-
-
-G_BEGIN_DECLS
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define GTK_TYPE_TABLE (gtk_table_get_type ())
-#define GTK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TABLE, GtkTable))
-#define GTK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TABLE, GtkTableClass))
-#define GTK_IS_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TABLE))
-#define GTK_IS_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TABLE))
-#define GTK_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TABLE, GtkTableClass))
-
-
-typedef struct _GtkTable GtkTable;
-typedef struct _GtkTablePrivate GtkTablePrivate;
-typedef struct _GtkTableClass GtkTableClass;
-typedef struct _GtkTableChild GtkTableChild;
-typedef struct _GtkTableRowCol GtkTableRowCol;
-
-struct _GtkTable
-{
- GtkContainer container;
-
- /*< private >*/
- GtkTablePrivate *priv;
-};
-
-struct _GtkTableClass
-{
- GtkContainerClass parent_class;
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-struct _GtkTableChild
-{
- GtkWidget *widget;
- guint16 left_attach;
- guint16 right_attach;
- guint16 top_attach;
- guint16 bottom_attach;
- guint16 xpadding;
- guint16 ypadding;
- guint xexpand : 1;
- guint yexpand : 1;
- guint xshrink : 1;
- guint yshrink : 1;
- guint xfill : 1;
- guint yfill : 1;
-};
-
-struct _GtkTableRowCol
-{
- guint16 requisition;
- guint16 allocation;
- guint16 spacing;
- guint need_expand : 1;
- guint need_shrink : 1;
- guint expand : 1;
- guint shrink : 1;
- guint empty : 1;
-};
-
-
-GType gtk_table_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(GtkGrid)
-GtkWidget* gtk_table_new (guint rows,
- guint columns,
- gboolean homogeneous);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_resize (GtkTable *table,
- guint rows,
- guint columns);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_attach (GtkTable *table,
- GtkWidget *child,
- guint left_attach,
- guint right_attach,
- guint top_attach,
- guint bottom_attach,
- GtkAttachOptions xoptions,
- GtkAttachOptions yoptions,
- guint xpadding,
- guint ypadding);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_attach_defaults (GtkTable *table,
- GtkWidget *widget,
- guint left_attach,
- guint right_attach,
- guint top_attach,
- guint bottom_attach);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_set_row_spacing (GtkTable *table,
- guint row,
- guint spacing);
-GDK_DEPRECATED_FOR(GtkGrid)
-guint gtk_table_get_row_spacing (GtkTable *table,
- guint row);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_set_col_spacing (GtkTable *table,
- guint column,
- guint spacing);
-GDK_DEPRECATED_FOR(GtkGrid)
-guint gtk_table_get_col_spacing (GtkTable *table,
- guint column);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_set_row_spacings (GtkTable *table,
- guint spacing);
-GDK_DEPRECATED_FOR(GtkGrid)
-guint gtk_table_get_default_row_spacing (GtkTable *table);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_set_col_spacings (GtkTable *table,
- guint spacing);
-GDK_DEPRECATED_FOR(GtkGrid)
-guint gtk_table_get_default_col_spacing (GtkTable *table);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_set_homogeneous (GtkTable *table,
- gboolean homogeneous);
-GDK_DEPRECATED_FOR(GtkGrid)
-gboolean gtk_table_get_homogeneous (GtkTable *table);
-GDK_DEPRECATED_FOR(GtkGrid)
-void gtk_table_get_size (GtkTable *table,
- guint *rows,
- guint *columns);
-
-#endif /* GTK_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __GTK_TABLE_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkmenuprivate.h"
-#include "gtkmenuitemprivate.h"
-#include "gtktearoffmenuitem.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtktearoffmenuitem
- * @Short_description: A menu item used to tear off and reattach its menu
- * @Title: GtkTearoffMenuItem
- * @See_also: #GtkMenu
- *
- * A #GtkTearoffMenuItem is a special #GtkMenuItem which is used to
- * tear off and reattach its menu.
- *
- * When its menu is shown normally, the #GtkTearoffMenuItem is drawn as a
- * dotted line indicating that the menu can be torn off. Activating it
- * causes its menu to be torn off and displayed in its own window
- * as a tearoff menu.
- *
- * When its menu is shown as a tearoff menu, the #GtkTearoffMenuItem is drawn
- * as a dotted line which has a left pointing arrow graphic indicating that
- * the tearoff menu can be reattached. Activating it will erase the tearoff
- * menu window.
- *
- * <note>#GtkTearoffMenuItem is deprecated and should not be used in newly
- * written code. Menus are not meant to be torn around.</note>
- */
-
-
-#define ARROW_SIZE 10
-#define TEAR_LENGTH 5
-#define BORDER_SPACING 3
-
-struct _GtkTearoffMenuItemPrivate
-{
- guint torn_off : 1;
-};
-
-static void gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static gboolean gtk_tearoff_menu_item_draw (GtkWidget *widget,
- cairo_t *cr);
-static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item);
-static void gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
- GtkWidget *previous);
-
-G_DEFINE_TYPE (GtkTearoffMenuItem, gtk_tearoff_menu_item, GTK_TYPE_MENU_ITEM)
-
-/**
- * gtk_tearoff_menu_item_new:
- *
- * Creates a new #GtkTearoffMenuItem.
- *
- * Returns: a new #GtkTearoffMenuItem.
- *
- * Deprecated: 3.4: #GtkTearoffMenuItem is deprecated and should not be
- * used in newly written code.
- */
-GtkWidget*
-gtk_tearoff_menu_item_new (void)
-{
- return g_object_new (GTK_TYPE_TEAROFF_MENU_ITEM, NULL);
-}
-
-static void
-gtk_tearoff_menu_item_class_init (GtkTearoffMenuItemClass *klass)
-{
- GtkWidgetClass *widget_class;
- GtkMenuItemClass *menu_item_class;
-
- widget_class = (GtkWidgetClass*) klass;
- menu_item_class = (GtkMenuItemClass*) klass;
-
- widget_class->draw = gtk_tearoff_menu_item_draw;
- widget_class->get_preferred_width = gtk_tearoff_menu_item_get_preferred_width;
- widget_class->get_preferred_height = gtk_tearoff_menu_item_get_preferred_height;
- widget_class->parent_set = gtk_tearoff_menu_item_parent_set;
-
- gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_TEAR_OFF_MENU_ITEM);
-
- menu_item_class->activate = gtk_tearoff_menu_item_activate;
-
- g_type_class_add_private (klass, sizeof (GtkTearoffMenuItemPrivate));
-}
-
-static void
-gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item)
-{
- GtkTearoffMenuItemPrivate *priv;
-
- tearoff_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (tearoff_menu_item,
- GTK_TYPE_TEAROFF_MENU_ITEM,
- GtkTearoffMenuItemPrivate);
- priv = tearoff_menu_item->priv;
-
- priv->torn_off = FALSE;
-}
-
-static void
-gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkStyleContext *context;
- guint border_width;
- GtkBorder padding;
- GtkStateFlags state;
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
- gtk_style_context_get_padding (context, state, &padding);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- *minimum = *natural = (border_width + BORDER_SPACING) * 2 + padding.left + padding.right;
-}
-
-static void
-gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkStyleContext *context;
- GtkBorder padding;
- GtkStateFlags state;
- GtkWidget *parent;
- guint border_width;
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
- gtk_style_context_get_padding (context, state, &padding);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- *minimum = *natural = (border_width * 2) + padding.top + padding.bottom;
-
- parent = gtk_widget_get_parent (widget);
- if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
- {
- *minimum += ARROW_SIZE;
- *natural += ARROW_SIZE;
- }
- else
- {
- *minimum += padding.top + 4;
- *natural += padding.top + 4;
- }
-}
-
-static gboolean
-gtk_tearoff_menu_item_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkMenuItem *menu_item;
- GtkStateFlags state;
- GtkStyleContext *context;
- GtkBorder padding;
- gint x, y, width, height;
- gint right_max;
- guint border_width;
- GtkTextDirection direction;
- GtkWidget *parent;
- gdouble angle;
-
- menu_item = GTK_MENU_ITEM (widget);
- context = gtk_widget_get_style_context (widget);
- direction = gtk_widget_get_direction (widget);
- state = gtk_widget_get_state_flags (widget);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_item));
- x = border_width;
- y = border_width;
- width = gtk_widget_get_allocated_width (widget) - border_width * 2;
- height = gtk_widget_get_allocated_height (widget) - border_width * 2;
- right_max = x + width;
-
- gtk_style_context_save (context);
- gtk_style_context_set_state (context, state);
- gtk_style_context_get_padding (context, state, &padding);
-
- if (state & GTK_STATE_FLAG_PRELIGHT)
- {
- gtk_render_background (context, cr, x, y, width, height);
- gtk_render_frame (context, cr, x, y, width, height);
- }
-
- parent = gtk_widget_get_parent (widget);
- if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
- {
- gint arrow_x;
-
- if (menu_item->priv->toggle_size > ARROW_SIZE)
- {
- if (direction == GTK_TEXT_DIR_LTR)
- {
- arrow_x = x + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
- angle = (3 * G_PI) / 2;
- }
- else
- {
- arrow_x = x + width - menu_item->priv->toggle_size + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
- angle = G_PI / 2;
- }
- x += menu_item->priv->toggle_size + BORDER_SPACING;
- }
- else
- {
- if (direction == GTK_TEXT_DIR_LTR)
- {
- arrow_x = ARROW_SIZE / 2;
- angle = (3 * G_PI) / 2;
- }
- else
- {
- arrow_x = x + width - 2 * ARROW_SIZE + ARROW_SIZE / 2;
- angle = G_PI / 2;
- }
- x += 2 * ARROW_SIZE;
- }
-
- gtk_render_arrow (context, cr, angle,
- arrow_x, height / 2 - 5,
- ARROW_SIZE);
- }
-
- while (x < right_max)
- {
- gint x1, x2;
-
- if (direction == GTK_TEXT_DIR_LTR)
- {
- x1 = x;
- x2 = MIN (x + TEAR_LENGTH, right_max);
- }
- else
- {
- x1 = right_max - x;
- x2 = MAX (right_max - x - TEAR_LENGTH, 0);
- }
-
- gtk_render_line (context, cr,
- x1, y + (height - padding.bottom) / 2,
- x2, y + (height - padding.bottom) / 2);
- x += 2 * TEAR_LENGTH;
- }
-
- gtk_style_context_restore (context);
-
- return FALSE;
-}
-
-static void
-gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item)
-{
- GtkWidget *parent;
-
- parent = gtk_widget_get_parent (GTK_WIDGET (menu_item));
- if (GTK_IS_MENU (parent))
- {
- GtkMenu *menu = GTK_MENU (parent);
-
- gtk_widget_queue_resize (GTK_WIDGET (menu_item));
- gtk_menu_set_tearoff_state (GTK_MENU (parent),
- !menu->priv->torn_off);
- }
-}
-
-static void
-tearoff_state_changed (GtkMenu *menu,
- GParamSpec *pspec,
- gpointer data)
-{
- GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (data);
- GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
-
- priv->torn_off = gtk_menu_get_tearoff_state (menu);
-}
-
-static void
-gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
- GtkWidget *previous)
-{
- GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (widget);
- GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
- GtkMenu *menu;
- GtkWidget *parent;
-
- parent = gtk_widget_get_parent (widget);
- menu = GTK_IS_MENU (parent) ? GTK_MENU (parent) : NULL;
-
- if (previous)
- g_signal_handlers_disconnect_by_func (previous,
- tearoff_state_changed,
- tearoff_menu_item);
-
- if (menu)
- {
- priv->torn_off = gtk_menu_get_tearoff_state (menu);
- g_signal_connect (menu, "notify::tearoff-state",
- G_CALLBACK (tearoff_state_changed),
- tearoff_menu_item);
- }
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_TEAROFF_MENU_ITEM_H__
-#define __GTK_TEAROFF_MENU_ITEM_H__
-
-
-#include <gtk/gtkmenuitem.h>
-
-
-G_BEGIN_DECLS
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define GTK_TYPE_TEAROFF_MENU_ITEM (gtk_tearoff_menu_item_get_type ())
-#define GTK_TEAROFF_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItem))
-#define GTK_TEAROFF_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass))
-#define GTK_IS_TEAROFF_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEAROFF_MENU_ITEM))
-#define GTK_IS_TEAROFF_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEAROFF_MENU_ITEM))
-#define GTK_TEAROFF_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass))
-
-
-typedef struct _GtkTearoffMenuItem GtkTearoffMenuItem;
-typedef struct _GtkTearoffMenuItemPrivate GtkTearoffMenuItemPrivate;
-typedef struct _GtkTearoffMenuItemClass GtkTearoffMenuItemClass;
-
-struct _GtkTearoffMenuItem
-{
- GtkMenuItem menu_item;
-
- /*< private >*/
- GtkTearoffMenuItemPrivate *priv;
-};
-
-struct _GtkTearoffMenuItemClass
-{
- GtkMenuItemClass parent_class;
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-
-GType gtk_tearoff_menu_item_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_tearoff_menu_item_new (void);
-
-#endif /* GTK_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __GTK_TEAROFF_MENU_ITEM_H__ */
#include "gtkmenushellprivate.h"
#include "gtkprivate.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
/* GObjectClass */
static GObject *gtk_tree_menu_constructor (GType type,
#include "gtkprivate.h"
#include "gtkuimanager.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
/**
* SECTION:gtkuimanager
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkvbbox.h"
-#include "gtkorientable.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtkvbbox
- * @Short_description: A container for arranging buttons vertically
- * @Title: GtkVButtonBox
- * @See_also: #GtkBox, #GtkButtonBox, #GtkHButtonBox
- *
- * A button box should be used to provide a consistent layout of buttons
- * throughout your application. The layout/spacing can be altered by the
- * programmer, or if desired, by the user to alter the 'feel' of a
- * program to a small degree.
- *
- * A #GtkVButtonBox is created with gtk_vbutton_box_new(). Buttons are
- * packed into a button box the same way widgets are added to any other
- * container, using gtk_container_add(). You can also use
- * gtk_box_pack_start() or gtk_box_pack_end(), but for button boxes both
- * these functions work just like gtk_container_add(), ie., they pack the
- * button in a way that depends on the current layout style and on
- * whether the button has had gtk_button_box_set_child_secondary() called
- * on it.
- *
- * The spacing between buttons can be set with gtk_box_set_spacing(). The
- * arrangement and layout of the buttons can be changed with
- * gtk_button_box_set_layout().
- *
- * GtkVButtonBox has been deprecated, use #GtkButtonBox instead.
- */
-
-G_DEFINE_TYPE (GtkVButtonBox, gtk_vbutton_box, GTK_TYPE_BUTTON_BOX)
-
-static void
-gtk_vbutton_box_class_init (GtkVButtonBoxClass *class)
-{
-}
-
-static void
-gtk_vbutton_box_init (GtkVButtonBox *vbutton_box)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (vbutton_box),
- GTK_ORIENTATION_VERTICAL);
-}
-
-/**
- * gtk_vbutton_box_new:
- *
- * Creates a new vertical button box.
- *
- * Returns: a new button box #GtkWidget.
- *
- * Deprecated: 3.2: Use gtk_button_box_new() with %GTK_ORIENTATION_VERTICAL instead
- */
-GtkWidget *
-gtk_vbutton_box_new (void)
-{
- return g_object_new (GTK_TYPE_VBUTTON_BOX, NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_VBBOX_H__
-#define __GTK_VBBOX_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkbbox.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GTK_TYPE_VBUTTON_BOX (gtk_vbutton_box_get_type ())
-#define GTK_VBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VBUTTON_BOX, GtkVButtonBox))
-#define GTK_VBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VBUTTON_BOX, GtkVButtonBoxClass))
-#define GTK_IS_VBUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VBUTTON_BOX))
-#define GTK_IS_VBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VBUTTON_BOX))
-#define GTK_VBUTTON_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VBUTTON_BOX, GtkVButtonBoxClass))
-
-
-typedef struct _GtkVButtonBox GtkVButtonBox;
-typedef struct _GtkVButtonBoxClass GtkVButtonBoxClass;
-
-struct _GtkVButtonBox
-{
- GtkButtonBox button_box;
-};
-
-struct _GtkVButtonBoxClass
-{
- GtkButtonBoxClass parent_class;
-};
-
-
-GType gtk_vbutton_box_get_type (void) G_GNUC_CONST;
-GtkWidget *gtk_vbutton_box_new (void);
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_VBBOX_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkboxprivate.h"
-#include "gtkorientable.h"
-
-#include "gtkvbox.h"
-#include "gtkboxprivate.h"
-
-
-/**
- * SECTION:gtkvbox
- * @Short_description: A vertical container box
- * @Title: GtkVBox
- * @See_also: #GtkHBox
- *
- * A #GtkVBox is a container that organizes child widgets into a single column.
- *
- * Use the #GtkBox packing interface to determine the arrangement,
- * spacing, height, and alignment of #GtkVBox children.
- *
- * All children are allocated the same width.
- *
- * GtkVBox has been deprecated. You can use #GtkBox instead, which is a
- * very quick and easy change. If you have derived your own classes from
- * GtkVBox, you can simply change the inheritance to derive directly
- * from #GtkBox, and set the #GtkOrientable::orientation property to
- * %GTK_ORIENTATION_VERTICAL in your instance init function, with a
- * call like:
- * |[
- * gtk_orientable_set_orientation (GTK_ORIENTABLE (object),
- * GTK_ORIENTATION_VERTICAL);
- * ]|
- * If you want your code to be future-proof, the recommendation is to
- * switch to #GtkGrid, since #GtkBox is going to be deprecated in favor
- * of the more flexible grid widget eventually. For more information
- * about migrating to #GtkGrid, see <xref linkend="gtk-migrating-GtkGrid"/>.
- */
-
-G_DEFINE_TYPE (GtkVBox, gtk_vbox, GTK_TYPE_BOX)
-
-static void
-gtk_vbox_class_init (GtkVBoxClass *class)
-{
-}
-
-static void
-gtk_vbox_init (GtkVBox *vbox)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (vbox),
- GTK_ORIENTATION_VERTICAL);
-
- _gtk_box_set_old_defaults (GTK_BOX (vbox));
-}
-
-/**
- * gtk_vbox_new:
- * @homogeneous: %TRUE if all children are to be given equal space allotments.
- * @spacing: the number of pixels to place by default between children.
- *
- * Creates a new #GtkVBox.
- *
- * Returns: a new #GtkVBox.
- *
- * Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_VERTICAL instead,
- * wich is a very quick and easy change. But the recommendation is to switch to
- * #GtkGrid, since #GtkBox is going to go away eventually.
- * See <xref linkend="gtk-migrating-GtkGrid"/>.
- */
-GtkWidget *
-gtk_vbox_new (gboolean homogeneous,
- gint spacing)
-{
- return g_object_new (GTK_TYPE_VBOX,
- "spacing", spacing,
- "homogeneous", homogeneous ? TRUE : FALSE,
- NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_VBOX_H__
-#define __GTK_VBOX_H__
-
-
-#include <gtk/gtkbox.h>
-
-
-G_BEGIN_DECLS
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define GTK_TYPE_VBOX (gtk_vbox_get_type ())
-#define GTK_VBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VBOX, GtkVBox))
-#define GTK_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VBOX, GtkVBoxClass))
-#define GTK_IS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VBOX))
-#define GTK_IS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VBOX))
-#define GTK_VBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VBOX, GtkVBoxClass))
-
-
-typedef struct _GtkVBox GtkVBox;
-typedef struct _GtkVBoxClass GtkVBoxClass;
-
-struct _GtkVBox
-{
- GtkBox box;
-};
-
-struct _GtkVBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-GType gtk_vbox_get_type (void) G_GNUC_CONST;
-GDK_DEPRECATED_FOR(gtk_box_new)
-GtkWidget * gtk_vbox_new (gboolean homogeneous,
- gint spacing);
-
-#endif
-
-G_END_DECLS
-
-#endif /* __GTK_VBOX_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkorientable.h"
-
-#include "gtkvpaned.h"
-
-
-/**
- * SECTION:gtkvpaned
- * @Short_description: A container with two panes arranged vertically
- * @Title: GtkVPaned
- *
- * The VPaned widget is a container widget with two
- * children arranged vertically. The division between
- * the two panes is adjustable by the user by dragging
- * a handle. See #GtkPaned for details.
- *
- * GtkVPaned has been deprecated, use #GtkPaned instead.
- */
-
-G_DEFINE_TYPE (GtkVPaned, gtk_vpaned, GTK_TYPE_PANED)
-
-static void
-gtk_vpaned_class_init (GtkVPanedClass *class)
-{
-}
-
-static void
-gtk_vpaned_init (GtkVPaned *vpaned)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (vpaned),
- GTK_ORIENTATION_VERTICAL);
-}
-
-/**
- * gtk_vpaned_new:
- *
- * Create a new #GtkVPaned
- *
- * Returns: the new #GtkVPaned
- *
- * Deprecated: 3.2: Use gtk_paned_new() with %GTK_ORIENTATION_VERTICAL instead
- */
-GtkWidget *
-gtk_vpaned_new (void)
-{
- return g_object_new (GTK_TYPE_VPANED, NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_VPANED_H__
-#define __GTK_VPANED_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkpaned.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_VPANED (gtk_vpaned_get_type ())
-#define GTK_VPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VPANED, GtkVPaned))
-#define GTK_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VPANED, GtkVPanedClass))
-#define GTK_IS_VPANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VPANED))
-#define GTK_IS_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VPANED))
-#define GTK_VPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VPANED, GtkVPanedClass))
-
-
-typedef struct _GtkVPaned GtkVPaned;
-typedef struct _GtkVPanedClass GtkVPanedClass;
-
-struct _GtkVPaned
-{
- GtkPaned paned;
-};
-
-struct _GtkVPanedClass
-{
- GtkPanedClass parent_class;
-};
-
-
-GType gtk_vpaned_get_type (void) G_GNUC_CONST;
-GtkWidget * gtk_vpaned_new (void);
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_VPANED_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2001 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include <math.h>
-#include <stdlib.h>
-
-#include "gtkvscale.h"
-#include "gtkorientable.h"
-
-
-/**
- * SECTION:gtkvscale
- * @Short_description: A vertical slider widget for selecting a value from a range
- * @Title: GtkVScale
- *
- * The #GtkVScale widget is used to allow the user to select a value using
- * a vertical slider. To create one, use gtk_hscale_new_with_range().
- *
- * The position to show the current value, and the number of decimal places
- * shown can be set using the parent #GtkScale class's functions.
- *
- * GtkVScale has been deprecated, use #GtkScale instead.
- */
-
-G_DEFINE_TYPE (GtkVScale, gtk_vscale, GTK_TYPE_SCALE)
-
-static void
-gtk_vscale_class_init (GtkVScaleClass *class)
-{
- GtkRangeClass *range_class = GTK_RANGE_CLASS (class);
-
- range_class->slider_detail = "vscale";
-}
-
-static void
-gtk_vscale_init (GtkVScale *vscale)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (vscale),
- GTK_ORIENTATION_VERTICAL);
-}
-/**
- * gtk_vscale_new:
- * @adjustment: the #GtkAdjustment which sets the range of the scale.
- *
- * Creates a new #GtkVScale.
- *
- * Returns: a new #GtkVScale.
- *
- * Deprecated: 3.2: Use gtk_scale_new() with %GTK_ORIENTATION_VERTICAL instead
- */
-GtkWidget *
-gtk_vscale_new (GtkAdjustment *adjustment)
-{
- g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
- NULL);
-
- return g_object_new (GTK_TYPE_VSCALE,
- "adjustment", adjustment,
- NULL);
-}
-
-/**
- * gtk_vscale_new_with_range:
- * @min: minimum value
- * @max: maximum value
- * @step: step increment (tick size) used with keyboard shortcuts
- *
- * Creates a new vertical scale widget that lets the user input a
- * number between @min and @max (including @min and @max) with the
- * increment @step. @step must be nonzero; it's the distance the
- * slider moves when using the arrow keys to adjust the scale value.
- *
- * Note that the way in which the precision is derived works best if @step
- * is a power of ten. If the resulting precision is not suitable for your
- * needs, use gtk_scale_set_digits() to correct it.
- *
- * Return value: a new #GtkVScale
- *
- * Deprecated: 3.2: Use gtk_scale_new_with_range() with %GTK_ORIENTATION_VERTICAL instead
- **/
-GtkWidget *
-gtk_vscale_new_with_range (gdouble min,
- gdouble max,
- gdouble step)
-{
- GtkAdjustment *adj;
- GtkScale *scale;
- gint digits;
-
- g_return_val_if_fail (min < max, NULL);
- g_return_val_if_fail (step != 0.0, NULL);
-
- adj = gtk_adjustment_new (min, min, max, step, 10 * step, 0);
-
- if (fabs (step) >= 1.0 || step == 0.0)
- {
- digits = 0;
- }
- else
- {
- digits = abs ((gint) floor (log10 (fabs (step))));
- if (digits > 5)
- digits = 5;
- }
-
- scale = g_object_new (GTK_TYPE_VSCALE,
- "adjustment", adj,
- "digits", digits,
- NULL);
-
- return GTK_WIDGET (scale);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_VSCALE_H__
-#define __GTK_VSCALE_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkscale.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GTK_TYPE_VSCALE (gtk_vscale_get_type ())
-#define GTK_VSCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VSCALE, GtkVScale))
-#define GTK_VSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSCALE, GtkVScaleClass))
-#define GTK_IS_VSCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VSCALE))
-#define GTK_IS_VSCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSCALE))
-#define GTK_VSCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VSCALE, GtkVScaleClass))
-
-
-typedef struct _GtkVScale GtkVScale;
-typedef struct _GtkVScaleClass GtkVScaleClass;
-
-/**
- * GtkVScale:
- *
- * The #GtkVScale struct contains private data only, and
- * should be accessed using the functions below.
- */
-struct _GtkVScale
-{
- GtkScale scale;
-};
-
-struct _GtkVScaleClass
-{
- GtkScaleClass parent_class;
-};
-
-
-GType gtk_vscale_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_vscale_new (GtkAdjustment *adjustment);
-GtkWidget* gtk_vscale_new_with_range (gdouble min,
- gdouble max,
- gdouble step);
-
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_VSCALE_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 2001 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkorientable.h"
-#include "gtkscrollbar.h"
-
-#include "gtkvscrollbar.h"
-#include "gtkintl.h"
-
-
-/**
- * SECTION:gtkvscrollbar
- * @Short_description: A vertical scrollbar
- * @Title: GtkVScrollbar
- * @See_also:#GtkScrollbar, #GtkScrolledWindow
- *
- * The #GtkVScrollbar widget is a widget arranged vertically creating a
- * scrollbar. See #GtkScrollbar for details on
- * scrollbars. #GtkAdjustment pointers may be added to handle the
- * adjustment of the scrollbar or it may be left %NULL in which case one
- * will be created for you. See #GtkScrollbar for a description of what the
- * fields in an adjustment represent for a scrollbar.
- *
- * GtkVScrollbar has been deprecated, use #GtkScrollbar instead.
- */
-
-G_DEFINE_TYPE (GtkVScrollbar, gtk_vscrollbar, GTK_TYPE_SCROLLBAR)
-
-static void
-gtk_vscrollbar_class_init (GtkVScrollbarClass *class)
-{
- GTK_RANGE_CLASS (class)->stepper_detail = "vscrollbar";
-}
-
-static void
-gtk_vscrollbar_init (GtkVScrollbar *vscrollbar)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (vscrollbar),
- GTK_ORIENTATION_VERTICAL);
-}
-
-/**
- * gtk_vscrollbar_new:
- * @adjustment: (allow-none): the #GtkAdjustment to use, or %NULL to create a new adjustment
- *
- * Creates a new vertical scrollbar.
- *
- * Returns: the new #GtkVScrollbar
- *
- * Deprecated: 3.2: Use gtk_scrollbar_new() with %GTK_ORIENTATION_VERTICAL instead
- */
-GtkWidget *
-gtk_vscrollbar_new (GtkAdjustment *adjustment)
-{
- g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
- NULL);
-
- return g_object_new (GTK_TYPE_VSCROLLBAR,
- "adjustment", adjustment,
- NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_VSCROLLBAR_H__
-#define __GTK_VSCROLLBAR_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkscrollbar.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GTK_TYPE_VSCROLLBAR (gtk_vscrollbar_get_type ())
-#define GTK_VSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VSCROLLBAR, GtkVScrollbar))
-#define GTK_VSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSCROLLBAR, GtkVScrollbarClass))
-#define GTK_IS_VSCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VSCROLLBAR))
-#define GTK_IS_VSCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSCROLLBAR))
-#define GTK_VSCROLLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VSCROLLBAR, GtkVScrollbarClass))
-
-
-typedef struct _GtkVScrollbar GtkVScrollbar;
-typedef struct _GtkVScrollbarClass GtkVScrollbarClass;
-
-/**
- * GtkVScrollbar:
- *
- * The #GtkVScrollbar struct contains private data and should be accessed
- * using the functions below.
- */
-struct _GtkVScrollbar
-{
- GtkScrollbar scrollbar;
-};
-
-struct _GtkVScrollbarClass
-{
- GtkScrollbarClass parent_class;
-};
-
-
-GType gtk_vscrollbar_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_vscrollbar_new (GtkAdjustment *adjustment);
-
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_VSCROLLBAR_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include "gtkorientable.h"
-
-#include "gtkvseparator.h"
-
-
-/**
- * SECTION:gtkvseparator
- * @Short_description: A vertical separator
- * @Title: GtkVSeparator
- * @See_also: #GtkHSeparator
- *
- * The #GtkVSeparator widget is a vertical separator, used to group the
- * widgets within a window. It displays a vertical line with a shadow to
- * make it appear sunken into the interface.
- *
- * GtkVSeparator has been deprecated, use #GtkSeparator instead.
- */
-
-G_DEFINE_TYPE (GtkVSeparator, gtk_vseparator, GTK_TYPE_SEPARATOR)
-
-static void
-gtk_vseparator_class_init (GtkVSeparatorClass *klass)
-{
-}
-
-static void
-gtk_vseparator_init (GtkVSeparator *vseparator)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (vseparator),
- GTK_ORIENTATION_VERTICAL);
-}
-
-/**
- * gtk_vseparator_new:
- *
- * Creates a new #GtkVSeparator.
- *
- * Returns: a new #GtkVSeparator.
- *
- * Deprecated: 3.2: Use gtk_separator_new() with %GTK_ORIENTATION_VERTICAL instead
- */
-GtkWidget *
-gtk_vseparator_new (void)
-{
- return g_object_new (GTK_TYPE_VSEPARATOR, NULL);
-}
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_VSEPARATOR_H__
-#define __GTK_VSEPARATOR_H__
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkseparator.h>
-
-G_BEGIN_DECLS
-
-
-#define GTK_TYPE_VSEPARATOR (gtk_vseparator_get_type ())
-#define GTK_VSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VSEPARATOR, GtkVSeparator))
-#define GTK_VSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSEPARATOR, GtkVSeparatorClass))
-#define GTK_IS_VSEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VSEPARATOR))
-#define GTK_IS_VSEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSEPARATOR))
-#define GTK_VSEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VSEPARATOR, GtkVSeparatorClass))
-
-
-typedef struct _GtkVSeparator GtkVSeparator;
-typedef struct _GtkVSeparatorClass GtkVSeparatorClass;
-
-/**
- * GtkVSeparator:
- *
- * The #GtkVSeparator struct contains private data only, and
- * should be accessed using the functions below.
- */
-struct _GtkVSeparator
-{
- GtkSeparator separator;
-};
-
-struct _GtkVSeparatorClass
-{
- GtkSeparatorClass parent_class;
-};
-
-
-GType gtk_vseparator_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_vseparator_new (void);
-
-
-G_END_DECLS
-
-#endif
-
-#endif /* __GTK_VSEPARATOR_H__ */